opposite query

2004-06-21 Thread Bob Lockie
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

Re: opposite query

2004-06-21 Thread SGreen
/2004 04:04 Subject: opposite query PM

Re: opposite query

2004-06-21 Thread Brent Baisley
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

Re: opposite query

2004-06-21 Thread Bob Lockie
On 06/21/2004 04:26 PM [EMAIL PROTECTED] spoke: I don't understand. You want every other record except .what? By flipping the equality the way you did, you should see all of the records where a.id = b.id (regardless of what the b.type value is) where a.type was not 'X' which is one reasonably

Re: opposite query

2004-06-21 Thread Bob Lockie
On 06/21/2004 05:02 PM Brent Baisley spoke: 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 It isn't what I want because there could be other a.type other than 'X'. Oops, that should be b.type I need to return the a

Re: opposite query

2004-06-21 Thread Michael Stassen
Bob Lockie wrote: On 06/21/2004 04:26 PM [EMAIL PROTECTED] spoke: I don't understand. You want every other record except .what? By flipping the equality the way you did, you should see all of the records where a.id = b.id (regardless of what the b.type value is) where a.type was not 'X'