title: SQL All Possible Round Robin Combinations between two Tables
body: <p>given table:</p>
  
  <pre><code>create table Person( Name varchar(100) )
  </code></pre>
  
  <p>where Name is unique for all Persons</p>
  
  <p>What SQL query can generate all possible n!/((n-2)!2!) round robin combinations?</p>
  
  <p>It is assumed that the cardinality of Person is ALWAYS equal to 4</p>
  
  <p>Example Person = {'Anna','Jerome','Patrick','Michael')</p>
  
  <p>Output:</p>
  
  <pre><code>Anna, Jerome
  Anna, Patrick
  Anna, Michael
  Jerome, Patrick
  Jerome, Michael
  Patrick, Michael
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>
  
  <p>Here's my answer (I used oracle SQL):</p>
  
  <pre><code>select P1.NAME PERSON1, P2.NAME PERSON2
    from (select rownum RNUM, NAME
          from PERSON) P1,
         (select rownum RNUM, NAME
            from PERSON) P2
   where P1.RNUM &lt; P2.RNUM
  </code></pre>