下面是我正在编写的查询,但由于某种原因,它在单词"ROLLUP"后面给了我一个语法错误,红色的波浪线在"("后面。
SELECT building, room_number, time_slot_id, COUNT(*)
FROM class1
GROUP BY ROLLUP (building, room_number, time_slot_id)
您需要在group by
中使用With Rollup
。试试这个语法
SELECT building, room_number, time_slot_id, COUNT(*)
FROM class1
GROUP BY building, room_number, time_slot_id WITH ROLLUP
有关更多信息,请查看此处