What you want to do is a left join and check for no match, like this: SELECT t1.*,t2.model_id FROM data1 as t1 LEFT JOIN data2 as t2 ON t1.model_id=t2.model_id WHERE t2.model_id IS NULL
You should be able to find lots of examples of this in the archives. This comes up a lot.
On Tuesday, November 4, 2003, at 02:31 PM, Agrin, Nathan wrote:
I'm looking for a way to select data from one table that is not found in
another. I am sorting on a column called 'model_id'. Basically I want
something like this to work:
"SELECT t1.*, t2.model_id FROM data1 as t1, data2 as t2 WHERE t1.model_id != t2.model_id"
t1 has about 1000 entries and t2 has around 500. Unfortunately when I run this SQL query mySQL seems to hang up and never produces any data. I'm running this through PHP and trying to display the information returned on a webpage. If you need any other info in order to help me, let me know.
Thanks in advance, -Nate
-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]