下面是我正在编写的查询,但由于某种原因,它在单词“ROLLUP”后面会给出一个语法错误在ROLLUP之后的“(”下面有一条红色的蠕动线。

SELECT building, room_number, time_slot_id, COUNT(*)
FROM class1
GROUP BY ROLLUP (building, room_number, time_slot_id)

最佳答案

您需要在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

关于mysql - 汇总子句的语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28491198/

10-11 05:13