title: SQL to return all related rows in a single column
body: <p>I've seen references to recursion in SQL Server, but I'm using MySQL and require the result to be in a single column. If I have a table of relationships:</p>
  
  <pre><code>itemID1 | itemiD2
  ---------------
    1     |   2
    1     |   3
    4     |   5
  </code></pre>
  
  <p>How do I select all IDs related to a single ID in either column? For example:</p>
  
  <p>1 ==> 2,3</p>
  
  <p>3 ==> 1,2</p>
  
  <p>I tried self joins, but can't get all related IDs in a single column. If there's a better schema for this it's not too late to change the table.</p>
  
  <p>Thank you. </p>