title: SQL unique combination of two columns
body: <p>Hi I'm stumped as to this problem as I need a unique combination of two instances of the same column.</p>
  
  <p>Let's say I have a table Animal with a column Name. I want all "unique" combinations of the animal name and not a repeat of it self or another already existing row.</p>
  
  <p>Sample data:</p>
  
  <pre><code>Name
  -------
  Mouse
  Cat
  Dog
  </code></pre>
  
  <p>The result I want is:</p>
  
  <pre><code>Name1   Name2
  -----   -----
  Mouse   Cat
  Mouse   Dog
  Cat     Dog
  </code></pre>
  
  <p>I wrote the following query:</p>
  
  <pre><code>SELECT DISTINCT A1.name AS Name1, A2.name as Name2
  FROM Animal A1, Animal A2
  WHERE A1.name &lt;&gt; A2.name;
  </code></pre>
  
  <p>Which netted me the following results instead:</p>
  
  <pre><code>Name1  Name2
  -----  -----
  Mouse  Cat
  Mouse  Dog
  Cat    Mouse
  Cat    Dog
  Dog    Mouse
  Dog    Cat
  </code></pre>
  
  <p>I hope I'm making sense. I don't want a duplicate of both combination, whether it appears on the left or on the right. As far as "Distinct" is concern the rows are distinct. So is there some way to eliminate the double up?</p>