I have a problem with mysql alias.
I have this query:
SELECT (`number_of_rooms`) AS total, id_room_type,
COUNT( fk_room_type ) AS reservation ,
SUM(number_of_rooms - reservation) AS result
FROM room_type
LEFT JOIN room_type_reservation
ON id_room_type = fk_room_type
WHERE result > 10
GROUP BY id_room_type
My problem start from SUM, cannot recognize reservation and then i want to use the result for a where condition. Like (where result > 10)