gpt4 book ai didi

mysql - rollup 子句的语法错误

转载 作者:行者123 更新时间:2023-11-29 01:39:40 26 4
gpt4 key购买 nike

下面是我正在写的查询,但由于某种原因,它在“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

了解更多信息 check here

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com