Skip to content
Advertisement

Remove same permutations from different multiple columns

Sample Data:

Excepted ouput:

The Logic :
Remove the same val permutations and retain the min val1 data.
e.g:
Remove 1,1 because they’re same.
Remove 2,1 because 1,2 exist…etc

Data SQL Script :

SQL Server 2012 | db<>fiddle

Advertisement

Answer

Here is one way to apply the two conditions:

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