title: How to use union in select clause?
body: <p>I have two tables (created here for example) like:</p>
  
  <pre><code>X1   Y1
  a   1
  b   2
  c   3
  d   4 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>X2   Y2
  a    5
  m    6
  n    7
  b    4
  </code></pre>
  
  <p>And I want the output column:</p>
  
  <pre><code>X    Y1   y2
  a    1    5
  b    2    4
  c    3    0
  d    4    0
  m    0    6
  n    0    7
  </code></pre>
  
  <p>What I tried is:</p>
  
  <pre><code>SELECT (A.X1 UNION B.X1) AS X, A.Y1,B.Y2
  FROM A FULL OUTER JOIN B
  ON A.X1 = B.X2
  </code></pre>
  
  <p>(the query mentioned above is just sample).
  After executing this query I am getting error message:</p>
  
  <blockquote>
    <p>Syntax error: near UNION in select clause</p>
  </blockquote>
  
  <p>Can someone tell me what is wrong here. Is there any other option to get the output table in the mentioned format?</p>