title: sql combining output of 2 columns into one column
body: <p>I've following tables </p>
  
  <pre><code>person: id,name
  1, mani
  2, senthil
  3, jack
  4, alan
  
  relation: relname,id1,id2 (id1 and id2 refers to person.id)
  rel1, 1,3
  rel2, 2,3
  rel1, 4,1
  </code></pre>
  
  <p>I want to form a query that returns the ids of person that are related one after another. Query should return:</p>
  
  <pre><code>1
  3
  2
  3
  4
  1
  </code></pre>
  
  <p>Here <code>(1,3)</code> is pair, followed by <code>(2,3)</code> and so on. </p>
  
  <p>Can you please form such a query?</p>