This is probably a very easy question for many of you.

I have two tables, 'Purchases' and 'Purchased_Items'.
For every purchase there is one entry in 'Purchases' and 1 or more entries on 'Purchased_Items' (depending on how many items were purchased'.
The two tables are linked by a 'ticket_number' column (same name in both tables).


Since life isn't perfect and sometimes purchases are deleted and in theory purchased_items would be deleted too but sometimes things happen and Purchased_Items are left behind after a 'Purchases' row is deleted (usually some human error).

I would like to have a query that would find all Purchased_Items that DON'T have a matching 'Purchases' record.
Something like:


select ticket_number from purchased_items where purchased_items.ticket_number != purchases.ticket_number;

Obviously the above statement doesn't give me the results I'm looking for.

Thanks!


Robert C. Best III - [EMAIL PROTECTED] District Technology Coordinator for N.E.R.I.C. at Potsdam Central School Phone: (315) 265-2000 x266


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to