下面是我正在写的查询,但由于某种原因,它在“ROLLUP”一词之后给出了一个语法错误,小红色波浪线在'('汇总之后)。
SELECT building, room_number, time_slot_id, COUNT(*)
FROM class1
GROUP BY ROLLUP (building, room_number, time_slot_id)
答案 0 :(得分:4)
您需要在With Rollup
中使用group by
。试试这个语法
SELECT building, room_number, time_slot_id, COUNT(*)
FROM class1
GROUP BY building, room_number, time_slot_id WITH ROLLUP
了解更多信息check here