打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
根据不通条件求和生成列
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
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
【工作中的常用SQL】应收账款账龄分析
SQL之case when then用法
急,这个SQL不会写了,大家帮我看看怎么写得?
留存信息统计
3.12伪代码
oracle 存储过程语句总结
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服