MySQL WITH ROLLUP
汇总
WITH ROLLUP提供汇总的累加值
SELECT name, SUM(balance) AS balance FROM tast_table GROUP BY name WITH ROLLUP;
WITH ROLLUP
会在最后加上一个汇总的值:
name | balance -------+--------- Teo | 100 Ada | 120 Mike | 110 (Null) | 330
SELECT name, SUM(balance) AS balance FROM tast_table GROUP BY name WITH ROLLUP;
WITH ROLLUP
会在最后加上一个汇总的值:
name | balance -------+--------- Teo | 100 Ada | 120 Mike | 110 (Null) | 330