I got a table like :
| Column A | Column B |
| ------------ | ------------ |
| 13 | 24 |
| 24 | 13 |
| 16 | 89 |
| 89 | 16 |
Since they include the same values in different columns for example 16-89 89-16 doesn't make a difference for my table and they duplicate. Can you help me on how to remove them? What I wanna reach is
Column A | Column B |
---|---|
13 | 24 |
16 | 89 |
Or
Column A | Column B |
---|---|
24 | 13 |
89 | 16 |
Doesn't make any difference for my data. Thank you all.
I couldn't reach anything. I tried to Distinct data but it doesn't work anyway.
1条答案
按热度按时间xiozqbni1#
This can be done using
LEAST
andGREATEST
:Demo on sql server 2022
If
LEAST
andGREATEST
are not supported :Demo here