title: MySQL: Select distinct combinations accross two rows, not double counting
body: <p>I have the following table</p>
  
  <pre><code>  dc  rc
  ----------
    AE  GB
    DE  US
    CN  DE
    DE  TT
    US  DE
    GB  AE
  </code></pre>
  
  <p>I want to select all unique dc, rc combinations, but irrespective of the order. In particular, the MySQL select should return</p>
  
  <pre><code>  dc  rc
  ----------
    AE  GB
    DE  US
    CN  DE
    DE  TT
  </code></pre>
  
  <p>i.e. it should not double count AE - GB and DE - US. I found some similar issues, e.g. when the database is one of relationships which always show up twice (e.g. on <a href="https://stackoverflow.com/questions/977648/filter-sql-query-by-a-unique-set-of-column-values-regardless-of-their-order">Filter SQL query by a unique set of column values, regardless of their order</a>). However, this is NOT the case here as there is no guarantee that the entry appears twice (in most cases it doesnt).</p>
  
  <p>Clearly, </p>
  
  <pre><code>SELECT DISTINCT dc, rc FROM table GROUP BY dc, rc
  </code></pre>
  
  <p>will NOT do the trick.</p>
  
  <p>I am grateful to any help</p>