October 17, 2003 at 10:35 am
Hello everyone,
I need to write a query that involves joining to tables. The first result set must include all the matching data (which I already have done). The second result set must include all the unmatching data from the joining table.
How can I write this query? Does anyone have any suggestions?
Thank you,
Peter.
P.S. Please email me at PFDBS@hotmail.com
Peter M. Florenzano
Database Administrator
October 17, 2003 at 2:33 pm
Change the inner join to left outer join and add a where clause
WHERE JoiningTable.key IS NULL
Far away is close at hand in the images of elsewhere.
Anon.
October 20, 2003 at 4:52 am
... as well as if that doesn't work an IN / NOT in command.
i.e for the first query that returns all thats linked, slap around it a NOT IN (Select...).
J
October 20, 2003 at 1:30 pm
As long as you won't have problems with duplication, do a left join and look for a NULL (Like David said)...that's the fastest way.
Else, use a:
"Where Not Exists (Select 1....correlated subquery...)"
Almost as fast, and no problem with duplicates caused by your join.
cl
Signature is NULL
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply