I have a table with listings that are being reviewed and another table that records which listings have been reviewed and the date they were reviewed
I’m trying to figure out if it is possible to form a mysql query that would allow me to output only the listings that have not yet been reviewed yet ( i.e. no entry for that listing in the reviewed table).
So in the example below. I would want to query the listing table to find any that haven’t been reviewed yet. In this case it would only return the first listing (id#1), because the other two have already been reviewed. Is this something that should be accomplished with a MySQL join?
Listings Table:
id|title
1|First Listing
2|Second Listing
3|Third Listing
etc.
Reviewed Table:
id|listing_id|review_date
1|2|2013_02_05
2|3|2013_02_05
You can use
LEFT JOINandNULLlike this:Or you can use
NOT IN:And here is the SQL Fiddle.
Good luck.