orderdt_jimmy表结构:
sql查询:
select sum(case when nid >= 1 and nid <= 1000 then amount end) t1, sum(case when nid >= 1001 and nid <= 5000 then amount end) t2, sum(case when nid >= 5001 then amount end) t3 from orderdt_jimmy; go
效果图:
原文:https://www.cnblogs.com/JimmySeraph/p/11347445.html