SELECT DISTINCT TWO columns not ranged How can I select distinct two columns not ranged correctly. 
for example: 
if I have this table t: 

================
|| a   || b   ||
=======||=======
|| 1   || 2   ||  
|| 1   || 3   ||
|| 2   || 3   ||
|| 3   || 1   ||
|| 2   || 1   ||
================


If I choose 1 in my query the result should be: 

================
|| a   || b   ||
=======||=======
|| 1   || 2   ||  
|| 1   || 3   ||
================


This table is a result of selecting the rows which has a=1 or b=1 and do not repeat a,b or the inverse. 
Details:

The result of SELECT * FROM t WHERE a=1 OR b=1; will be: 

================
|| a   || b   ||
=======||=======
|| 1   || 2   ||  
|| 1   || 3   ||
|| 3   || 1   ||
|| 2   || 1   ||
================


I should eliminate the repeated rows normally and inversely. 

|| 2   || 1   || will be eliminated because it's the inverse of || 1   || 2   ||

|| 3   || 1   || will be eliminated because it's the inverse of || 1   || 3   || 

The result was shown above.
A more efficient (and somewhat shorter) version of what Jon of All Trades mentioned in his answer could be something like this:

SELECT DISTINCT 
CASE WHEN A &lt; B THEN A ELSE B END AS value1,
CASE WHEN A &lt; B THEN B ELSE A END AS value2
FROM T


Of course if you had to only check for tuples that contain 1, you would add something like WHERE A = 1 OR B = 1