I am getting an error saying that the total_calories in the HAVING clause is not a valid column:
SELECT type, SUM(calories) AS total_calories FROM exercise_logs
GROUP BY type
HAVING total_calories > 150;
Any ideas why this is happening? Thank you.