select oid,SUM(amount) as total from get_out_list where state=1 group by oid
select oid,SUM(case when state=1 then amount else 0 end) as total,
SUM(case when state=5 then amount else 0 end) as total1
from get_out_list group by oid
效果如下
oid total total1
17 3400 0
18 2500 0
19 5300 -699
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。