WITH ROLLUP เป็น Modifier ใช้กับ GROUP BY เพิ่มแถวสรุป (Summary Rows) ระดับสูงขึ้น
ตัวอย่าง
mysql> Select Item, SUM(Price) AS Price from ratelist Group by item WITH ROLLUP; +------+-------+ | Item | Price | +------+-------+ | A | 502 | | B | 630 | | C | 1005 | | h | 850 | | T | 250 | | NULL | 3237 | +------+-------+ 6 rows in set (0.00 sec)
แถวสุดท้าย NULL คือ Grand Total (3237)