Below are my tables
properties bookings
========== ==========
property_id booking_id
price property_id
city checkin_date
checkout_date
I have two tables, Properties and Bookings for a rental site. I want to do a search by check in date, check out date, price and location. It will check the availability from the foreign table bookings via the property_id FK.
Basically I want it to be something like:
SELECT property_id,price,city FROM properties
WHERE
price > 200,
city = "Toronto",
LEFT JOIN (
SELECT postid, COUNT( * ) AS total
FROM bookings
WHERE checkin_date *** SOMEHTING HERE ****
I am sure the above is incorrect already. Whether if I am to use left join or inner join.