查询结果的where子句

时间:2014-09-12 20:27:25

标签: mysql sql

我想获取金额不是= 0

我的查询

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

从中我得到的所有客户的结果也是0。

1 个答案:

答案 0 :(得分:0)

您正在寻找HAVING命令

将此添加到最后

having amount <> 0