0

I want to fetch amount which not = 0

my query

select c.c_name, sum(cp.invoice_amount)-sum(cp.recived_amount) as amount from customer_payments cp
inner join customer c on c.c_id = cp.customer_id group by c.c_name

from which I am getting result of all customer that also having 0 amount.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Your looking for the HAVING command

add this to the end

having amount <> 0
exussum
  • 18,275
  • 8
  • 32
  • 65