I have two tables on my database.
One called room and another is called room_booking.
Both room and room booking have the same column room_id.
I’ve drafted the following SQL query that checks for rooms with a specific date:
SELECT DISTINCT room_id FROM `room_booking` WHERE date_booked='$date'";
But now I need to use the list of id’s to access the info respective rooms in room_booking. The fields I am interested in are name and room_size.
How can I achieve this? Would I require a joint SQL statement?
Thanks in advance!
Yes. You should Join both tables for getting results.
Try below