Hi,

Thanks.  So what you are saying is if a record is not there it is
considered NULL?

Regards,

Justin Palmer


-----Original Message-----
From: Brent Baisley [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 15, 2004 12:54 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: SELECT ?


Absolutely, do a left join and check for NULL values from the other 
table.

SELECT t1.*
FROM t1
LEFT JOIN t2 ON t1.id=t2.id
WHERE
t2.id IS NULL

The left join retains all records in the first table regardless of 
matches in the second. You then filter out those records with a null 
value in a table 2 field.


On Apr 15, 2004, at 3:46 PM, Justin Palmer wrote:

> Hi,
>
> Is it possible to select all records from one table that don't have an

> entry in another table.  Something like:
>
> SELECT t1.*
> FROM  'TABLE1' AS t1,
>       'TABLE2' AS t2
> WHERE t1.cv = 1
> AND   t1.id != t2.id
>
-- 
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]

Reply via email to