title: UNION two tables with different number of columns
body: <p>I am trying to perform a <code>UNION</code> between two tables that have a different number of columns. From <a href="https://stackoverflow.com/questions/2309943/unioning-two-tables-with-different-number-of-columns">this question</a>  I know that you need to add extra null columns on the table with fewer columns but doing this causes the following error:</p>
  
  <pre><code>Error code -1, SQL state 42X01: Syntax error: Encountered "null" at line 1, column 75.
  </code></pre>
  
  <p>The query is:</p>
  
  <pre><code>SELECT column1, column2 
  from APP.lefttable 
  WHERE column2 = 'value' 
  union all 
  select column1, null as column2 
  from APP.righttable";
  </code></pre>
  
  <p>I only want a single column on the right hand side of the <code>UNION</code> clause so I am trying to make one of the columns null but the above error appears.</p>
  
  <p>If it helps I'm doing this in a Java application using Apache Derby as my RDBMS.</p>