For at bruge DISTINCT
klausul, skal du sortere de to første kolonner manuelt:
SELECT DISTINCT
CASE WHEN (col1 < col2) THEN col1 else col2 END AS Col1,
CASE WHEN (col1 < col2) THEN col2 else col1 END AS Col2,
col3
FROM t
For at bruge DISTINCT
klausul, skal du sortere de to første kolonner manuelt:
SELECT DISTINCT
CASE WHEN (col1 < col2) THEN col1 else col2 END AS Col1,
CASE WHEN (col1 < col2) THEN col2 else col1 END AS Col2,
col3
FROM t