The opposite of the query would be a.type!='X' and there is no related record in table b. Not sure if that is what you what, but this is what the query would look like:

select name from a left join b on a.id=b.id where b.id is null and a.type!='X'


On Jun 21, 2004, at 4:04 PM, Bob Lockie wrote:

I have:
select name from a, b where a.type='X' and a.id=b.id;

I want a query to return all the rows that were NOT found by the above query.

I can't simply do:
select name from a, b where a.type!='X' and a.id=b.id;
because there is more than one row in b for each type!='X' but there is only one row in b for each type='X'


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



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