I have a table with the following structure:
Type Value
A abc
A def
A xyz
I want a result set that will be all possible combinations of the "Value" but should be distinct as well.
Result Set:
Value
abc def
abc xyz
def xyz
abc def xyz
If the result set has "abc def", I don't want "def abc" to show up. Even though these are 2 distinct values, these are duplicates for me. I'm stuck on 2 things:
- How to eliminate duplicates?
- In the table structure above, I had one type "A" with 3 values. The same table will have multiple types and each type will have different number of values. For instance, I will have Type "B" with say 4 values. How do I figure out how many times I need to iterate through each type.
Any help will be appreciated.