Checking Two Tables For Matching Records
Posted 13 December 2012 - 03:55 PM
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 - 05: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 - 05:28 PM.
|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
|baaSelect| generate js and php code for dynamic linked dropdowns
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users