title: How to use SQL DISTINCT to remove duplicates from multiple columns?
body: <p>Let's say I have a table with lots of duplicated values. I want to remove the duplicates for each column <em>individually</em>. Using <code>DISTINCT</code> removes duplicate combinations of columns so other columns still contain duplicated values. </p>
  
  <p>Original table is:</p>
  
  <pre><code>Col1 | Col2 | Col3    
  -----+------+------
   a1  | b1   | c1    
   a1  | b2   | c1
   a2  | b1   | NULL
   a2  | b2   | c1    
   a3  | b1   | c1
   a3  | NULL | NULL
  </code></pre>
  
  <p>My desire result is:</p>
  
  <pre><code>Col1 | Col2 | Col3    
  -----+------+------
   a1  | b1   | c1    
   a2  | b2   | NULL    
   a3  | NULL | NULL
  </code></pre>
  
  <p>I can get this result by several query separately: </p>
  
  <pre><code>SELECT DISTINCT Col1 
  FROM TABLE
  
  SELECT DISTINCT Col2 
  FROM TABLE
  
  SELECT DISTINCT Col3 
  FROM TABLE
  </code></pre>
  
  <p>But how can I do it in a singe query and return result in one result set?</p>
  
  <p>Thanks</p>