首页 > 其他 > 详细

group by with rollup

时间:2020-01-28 14:30:08      阅读:75      评论:0      收藏:0      [点我收藏+]

group by with rollup,在group by 之上在进行一次汇总

mysql> select coalesce(staff_id,汇总), sum(amount) from payment group by staff_id with rollup;
+-----------------------------+-------------+
| coalesce(staff_id,汇总)   | sum(amount) |
+-----------------------------+-------------+
| 1                           |    33489.47 |
| 2                           |    33927.04 |
| 汇总                        |    67416.51 |
+-----------------------------+-------------+

 

group by with rollup

原文:https://www.cnblogs.com/wooluwalker/p/12237978.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!