MySQL 深潜 - 重构后的 ROLLUP 实现 ROLLUP 功能简述 ROLLUP 可以在普通的 GROUP BY 聚合的情况下,增加更多层次的聚集输出。比如以下这条 SQL: SELECT year, country, product, SUM(profit) AS profit FROM sales GROUP BY year, country, product WITH ROLLUP; 除了计算按照年份、国家、产品分组的利润总和,也会计算按照年份、国家(GROUP BY year, count on 2024-05-01 | by 李博(泊歌) 0