-2
Select facid, sum(slots) as total
from cd.bookings 
group by facid 
having total > 1000
order by facid;

1 Answers1

0

You can't reference a column alias in the HAVING clause, you have to repeat the expression:

Select facid, sum(slots) as total
from cd.bookings 
group by facid 
having sum(slots) > 1000
order by facid;