I'm trying to join 2 sql queries in one query.
The first one gets the count of rooms per hotel. The second one gets the count of checked guests in hotel. I'm trying to get occupancy rate per hotel.
SELECT hotel_id, count(room_id)
FROM room
group by room.hotel_id
SELECT h.hotel_id, count(k.room_id)
FROM room_reservation as kr , room as k , hotel as h
where kr.room_id = k.room_id and k.hotel_id = h.hotel_id
group by k.hotel_id
How can i do this ?
number of guests/all rooms,number of guests/occupied roomsornumber of occupied rooms/all rooms?