如果汇总总数为“500”,我希望结果显示为“总计”,而不是当前显示为“空”
另外,我不确定如何添加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
1条答案
按热度按时间gk7wooem1#
这对我很有用:
http://www.sqlfiddle.com/#!18/8647e/4号
结果: