Write a query to display hotel id, hotel name, and number of orders taken by hotels that have taken orders more than 5 times. Give an alias name for number of orders as 'NO_OF_ORDERS'.sort the result based on hotel id in ascending order.
The Query I wrote:
select hotel_details.hotel_id, hotel_name, count(orders.hotel_id) as no_of_orders
from hotel_details join orders on hotel_details.hotel_id = orders.hotel_id
where no_of_orders > 5
group by orders.hotel_id order by no_of_orders;
Error I go:
unkown column 'number_of_orders' in 'where clause'