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
  • 34,719
  • 24
  • 185
  • 251

1 Answers1

0

Your looking for the HAVING command

add this to the end

having amount <> 0
exussum
  • 17,675
  • 8
  • 30
  • 64