Checking Two Tables For Matching Records
Posted 13 December 2012 - 10:55 AM
So for example I have a table called 'orders' which have a primary key of order_id.
Then I have a table called 'order_comments' which also has a field called order_id and I want to run a query that will check which orders don't have entries in order_comments.
Thanks for any help
Posted 13 December 2012 - 12:28 PM
FROM orders o
LEFT JOIN order_comments c USING (order_id)
WHERE c.order_id IS NULL
Edited by Barand, 13 December 2012 - 12:28 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users