Select statement to get the difference

2003-10-01 Thread Stefan Berger
How to tell it in MySQL 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

Re: Select statement to get the difference

2003-10-01 Thread Antony Dovgal
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

Re: Select statement to get the difference

2003-10-01 Thread Lourdes Millán
Stefan Berger escribió: How to tell it in MySQL 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

Re: Select statement to get the difference

2003-10-01 Thread Randy Chrismon
I need to know which id is not present in the other table. Stefan: A left join should do it: select t1.id from t1 left join t2 on t1.id=t2.id where t2.id is null I learned this from this mailing list about two weeks ago. HTH. Randy -- MySQL General Mailing List For list archives: