i have a table"Dummy" with columns "col1 and col2".
How do i find unique pairs from(col1,col2). For example in the above table how do i get (a,b) or (b,a) only as my output, instead of both (a,b) and (b,a).
select
distinct
col1
col2
from
dummy
where
dummy.col1 < dummy.col2
group by
col1,
col2;
the above query is wrong as it missed out the pair (d,c).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…