Use LEFT JOIN

SELECT t1.*, t2.id FROM table1 as t1 LEFT JOIN table2 as t2 ON
t1.id=t2.id WHERE t2 IS NULL; 
<-- something like that -->


-->-----Original Message-----
-->From: Martin Moss [mailto:[EMAIL PROTECTED]
-->Sent: Tuesday, September 02, 2003 1:50 PM
-->To: [EMAIL PROTECTED]
-->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
-->
-->
-->---
-->Outgoing mail is certified Virus Free.
-->Checked by AVG anti-virus system (http://www.grisoft.com).
-->Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
-->
-->
-->--
-->MySQL General Mailing List
-->For list archives: http://lists.mysql.com/mysql
-->To unsubscribe:
-->http://lists.mysql.com/[EMAIL PROTECTED]




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

Reply via email to