syntax error with rollup clause

783 Views Asked by At

below is the query I am writing, but for some reason it gives me a syntax error right after the word 'ROLLUP' the little red squiggle line is under the ' ( ' after rollup.

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

There are 1 best solutions below

3
On BEST ANSWER

You need to use With Rollup in group by. Try this syntax

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

for more info check here