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 to get the difference of two tables


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 null;

--
Roger


--
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