On Wed, 1 Oct 2003 10:56:59 +0200
"Stefan Berger" <[EMAIL PROTECTED]> wrote:

>  
> I have 2 tables and i want to find difference (the id exists in one
> table but in the other not) between them. 
>  
> With SELECT attachment_id from tbl_attachment, tbl_msg2atta where
> attachment_id = atta_id
> i receive all id wich are equals in both tables.
>  
> I need to know which id is not present in the other table.   

SELECT
attachment_id
FROM
tbl1 LEFT JOIN tbl2
ON 
tbl1.field = tbl2.field
WHERE 
tbl2.field IS NULL;


P.S. read about SELECT & LEFT JOIN in manual.

---
WBR,
Antony Dovgal aka tony2001
[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