title: Filter table so that rows where swapped column duplicates are not returned
body: <p>I have a table that records duplicate entities (a and b) in two columns. </p>
  
  <p>The way the UI works is that if I go to a's page, the db is searched for a duplicate and if one is found a row is inserted like fig. 1 shows. If I navigate to b's page, another duplicate will be inserted and fig.2 is produced.</p>
  
  <p>I cannot touch the code that does the inserting. I need to be able to filter this table to return only one of the rows from fig.2 (there are hundreds of rows with this mirrored data).</p>
  
  <p>I have tried using cte's and self-joins to filter, but there aren't any filters I've thought to apply that work for one case and not the other.</p>
  
  <p>E.g. something like:</p>
  
  <pre><code>Select * from duplicates d1
  join duplicates d2
  on Entity != Duplicate
  </code></pre>
  
  <p>...just filters out everything. My guess is the solution lies in a row numbering and a filter that excludes everything but row 1, but I'm not sure how to properly group and assign row numbers to accomplish this. </p>
  
  <p>fig.1    </p>
  
  <pre><code>Entity     Duplicate
  a          b
  </code></pre>
  
  <p>fig.2</p>
  
  <pre><code>Entity     Duplicate
  a          b
  b          a
  </code></pre>