Hi,
Newb question here,
I have two tables (A & B) that I want to join and exclude the elements that
match, what would be the best aproach for this? thanks in advance. (BTW I'm
comparing 5 fields that have to match from each table: A1 = B1 And A2 = B2
... and so forth.)SELECT <columnList>
FROM TableA A
FULL OUTER JOIN TableB B
ON A.Col1 = b.Col1 And A.Col2 = B.Col2 AND ...
WHERE A.Col1 IS NULL OR B.Col1 IS NULL
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Manny" <Manny@.discussions.microsoft.com> wrote in message
news:DA005CA3-B3FA-44C8-9F86-00CA28ACEFF2@.microsoft.com...
> Hi,
> Newb question here,
> I have two tables (A & B) that I want to join and exclude the elements
> that
> match, what would be the best aproach for this? thanks in advance. (BTW
> I'm
> comparing 5 fields that have to match from each table: A1 = B1 And A2 = B2
> ... and so forth.)
>|||Manny
> I have two tables (A & B) that I want to join and exclude the elements
that
> match,
You meant that all data from A that does not exist in B?
Look up LEFT/RIGHT/FULL join combinations in the BOL and WHERE NOT EXISTS
command as well.
"Manny" <Manny@.discussions.microsoft.com> wrote in message
news:DA005CA3-B3FA-44C8-9F86-00CA28ACEFF2@.microsoft.com...
> Hi,
> Newb question here,
> I have two tables (A & B) that I want to join and exclude the elements
that
> match, what would be the best aproach for this? thanks in advance. (BTW
I'm
> comparing 5 fields that have to match from each table: A1 = B1 And A2 = B2
> ... and so forth.)
>|||"Uri Dimant" wrote:
> You meant that all data from A that does not exist in B?
> Look up LEFT/RIGHT/FULL join combinations in the BOL and WHERE NOT EXISTS
> command as well.
Thanks Uri & Roji for your responses,
Yes, well I actually need 3 results:
1) Information that matches A & B (which was the easiest for me :)
2) Information that exists in A different from B (excluding the match)
3) Information that exists in B different from A (excluding the match)
I'll look up the join conditions you guys are sugesting, thanks again.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment