RE: Need a query to get the difference of two tables

2005-01-31 Thread Harish
: mysql Cc: Harish; Michael Stassen Subject: Re: Need a query to get the difference of two tables Harish wrote: > Hi All, > > This query worked for me. > > SELECT a.address >FROM a >LEFT JOIN b ON a.id != b.iid AND b.message='y' Strange... that query sho

Re: Need a query to get the difference of two tables

2005-01-31 Thread Roger Baklund
Harish wrote: Hi All, This query worked for me. SELECT a.address FROM a LEFT JOIN b ON a.id != b.iid AND b.message='y' Strange... that query should give far too many and wrong rows as a result, and it would take a long time to run on a big dataset... you are joining each row in table a with

RE: Need a query to get the difference of two tables

2005-01-31 Thread Harish
:15 PM To: mysql Cc: Michael Stassen Subject: Re: Need a query to get the difference of two tables Michael Stassen wrote: > > Roger Baklund wrote: [...] >> select a.address >> from a >> left join b on b.iid=a.id >> where b.iid is null; > > > That&#x

RE: Need a query to get the difference of two tables

2005-01-31 Thread Harish
ubject: Re: Need a query to get the difference of two tables Roger Baklund wrote: > Harish wrote: > >> Hi, >> >> I apprecaite anybody replying me with an equvalent query for this: >> I am using mysql 4.0.21 >> >> >> select a.address from a wh

Re: Need a query to get the difference of two tables

2005-01-31 Thread Roger Baklund
Michael Stassen wrote: Roger Baklund wrote: [...] select a.address from a left join b on b.iid=a.id where b.iid is null; That's not equivalent, because it leaves out a condition. I think it should be SELECT a.address FROM a LEFT JOIN b ON a.id = b.iid AND b.message='y' WHERE b.iid

RE: Need a query to get the difference of two tables

2005-01-31 Thread Harish
ubject: Re: Need a query to get the difference of two tables Roger Baklund wrote: > Harish wrote: > >> Hi, >> >> I apprecaite anybody replying me with an equvalent query for this: >> I am using mysql 4.0.21 >> >> >> select a.address from a wh

Re: Need a query to get the difference of two tables

2005-01-30 Thread Michael Stassen
ng the ids to strings to be compared. Ouch. Michael -Original Message- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: Sunday, January 30, 2005 7:19 PM To: mysql Cc: Harish Subject: Re: Need a query to get the difference of two tables Harish wrote: Hi, I apprecaite anybody replyin

Re: Need a query to get the difference of two tables

2005-01-30 Thread Michael Stassen
Roger Baklund wrote: Harish wrote: Hi, I apprecaite anybody replying me with an equvalent query for this: I am using mysql 4.0.21 select a.address from a where a.id not in (select b.iid from b where b.message='y') This can be done with a left join: select a.address from a left join b on b.iid=

RE: Need a query to get the difference of two tables

2005-01-30 Thread Ferhat BINGOL
SELECT a.address FROM a, b WHERE (a.id LIKE b.id) AND (b.message NOT LIKE 'y') -Original Message- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: Sunday, January 30, 2005 7:19 PM To: mysql Cc: Harish Subject: Re: Need a query

Re: Need a query to get the difference of two tables

2005-01-30 Thread Roger Baklund
Harish wrote: Hi, I apprecaite anybody replying me with an equvalent query for this: I am using mysql 4.0.21 select a.address from a where a.id not in (select b.iid from b where b.message='y') This can be done with a left join: select a.address from a left join b on b.iid=a.id where b.iid is