I have following table structures:
Item:
-----------------------
item_id INT (PRIMARY),
category_id MEDIUMINT,
name VARCHAR(40)
reservation:
-----------------------
id INT (PRIMARY),
item_id INT,
date DATE,
slot VARCHAR(50)
i want all rows of a particular category_id from table Item with a join to reservation table ON column item_id WHERE reservation.date = ‘something’ to be returned in a query. There is no guarantee that reservation row will be available with the queried date. But i need all the rows of corresponding category_id to be returned from Item table even if reservation row is absent. How can this be achived?
regards,
ravi.
Sounds like a
left joinwould fit the bill. If you add the date restriction to theonclause, the date restriction will not filter out rows fromItem.