April 2, 2005 at 11:32 am
I can't seem to find any info on how to do this...so maybe someone here can help.
I have a bunch of nested queries which eventually return a result set that has two columns of type decimal. These two columns (Member_1, Member_2) are actually the same field from a table.
What I am doing is matching up two "Members" based on a bunch of criteria. The resulting table is great but the problem I'm running into is the there can be a row where
Member_1, Member_2 (is the same as) Member_2, Member_1
I don't want that. I only want a unique combination of the two members being together.
Here is an example of the table (view) I have gotten to:
Member_1 Member_2
1 7
2 11
7 42
7 1
11 2
42 7
If anyone can help me with this...I would be greatful!
KC
www.allyson-kas.com
April 2, 2005 at 1:55 pm
SELECT DISTINCT
CASE
WHEN Member_1 < Member_2
THEN Member_1
ELSE Member_2
END As Member_1,
CASE
WHEN Member_1 > Member_2
THEN Member_1
ELSE Member_2
END As Member_2
FROM YourTable
April 2, 2005 at 2:34 pm
WOW!
Thank you so very much!
KC
www.allyson-kas.com
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply