我使用此查询来获取:从tblcustomers 客户名称 transactionamount的总和从tbltransactions针对每个客户如何在mysql查询中获得想要的结果?
select a.customerid, sum(transactionamount) as transactionamount ,b.customername
from tbltransactions a
join tblcustomers b using (customerid)
group by a.customerid
order by b.customername
的coloumn transactionamount
在tbltransactions
包含了客户购买和负值客户支付正值。
如何在此查询中获得此表达式min(transactionamount)< 0对于每个客户?
编辑:分钟(transactionamount)< 0给我的每一个客户迄今所支付的最高金额
解释通过的话你的意图,你的尝试并不清楚你想要什么。 – zerkms
'有MAX(transactionamount)<0' groupy由可能工作 – Rufinus