Skip to content
Advertisement

Oracle: how to get unique combinations of 2 sets

sample data:

Data looks like group: 1 set: 1,2,3

I want to get all combinations of this 2 tables but UNIQUE ( 1,2,3 it’s same as 1,3,2), so output would be like this:

I tried using connect_by_path, but it get’s me or same combinations (like 1-132) or some combinations are missing. Any ideas?

Advertisement

Answer

Assuming that you don’t have duplicated values in set_ and that you missed 1-23 in the expected result, this could be a way:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement