如果累积总数为“500”,我希望结果显示“总计”和“总计”。而不是它当前显示的位置' null'
另外,我不确定如何添加WHERE子句来仅查看2018年期间处理的交易?
有什么想法吗?谢谢
select date_format(TRANSACTION_DATE, '%M') AS MONTH,
SUM(SALES_AMOUNT) TOTAL
FROM SALES
GROUP BY DATE_FORMAT(TRANSACTION_DATE, '%M') WITH ROLLUP
January 160.00
June 100.00
May 240.00
Null 500.00
答案 0 :(得分:0)
这对我有用:
http://www.sqlfiddle.com/#!18/8647e/4
| | |
|---------|-----|
| January | 160 |
| June | 100 |
| May | 240 |
| Total | 500 |
结果:
enumerate