Hi Marty,

Yes, a query like this:

SELECT t1.* FROM table1 t1
LEFT JOIN table2 t2 ON (t2.id=t1.id)
WHERE t2.id IS NULL

This assumes that table2.id is defined as NOT NULL.

See also: http://www.mysql.com/doc/en/JOIN.html

Hope that helps.

Matt


----- Original Message -----
From: "Martin Moss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 3:54 PM
Subject: Select from one table where ID not in another table


> All,
>
> Am wondering if it's possible to do a query that does something like
this:-
>
> SELECT table1.*,table2.id from Table1 AS table1,Table2 AS table2
> WHERE table1.id DOESN'T EXIST IN table2.id;
>
>
> Regards
>
> Marty


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

Reply via email to