假设我在桌子上有这些。
Index Resultant First Second
1 Ice Water Cold
2 Cold Air Water Cold
3 Cold Wind Water Cold
4 Hot Air Volcano Air
5 Normal Air Oxygen Hydrogen
6 Ice Cold Water
7 Cold Air Cold Water
8 Cold Wind Cold Water
我想只显示这些
Index Resultant First Second
1 Ice Water Cold
2 Cold Air Water Cold
3 Cold Wind Water Cold
4 Hot Air Volcano Air
5 Normal Air Oxygen Hydrogen
因为底部3区域全部重复,如果你翻转它们。但我不希望第1,2行被隐藏,因为它也是水和冷的组合。
答案 0 :(得分:6)
select least(col1, col2), greatest(col1, col2)
from MyTable
group by least(col1, col2), greatest(col1, col2)