title: SQLite Union of n tables with m columns
body: <p>I have this problem. There are n tables created dynamically and each table has m columns, the columns could be repeated. This tables have in common 2 columns but there is no related data between them, for example:
          Table1
  | A | B | Col1 | Col2 |</p>
  
  <pre><code>    Table2
  </code></pre>
  
  <p>| A | B | Col3 | Col4 |</p>
  
  <pre><code>    Table3
  </code></pre>
  
  <p>| A | B | Col1 | Col2 | Col4 |</p>
  
  <p>What I want to do is to merge all the tables into a big one like this:</p>
  
  <pre><code>    BigTable
  </code></pre>
  
  <p>| A | B | Col1 | Col2 | Col3 | Col4 |</p>
  
  <p>And all the rows concatenated, for example if in table1 rows = 5, table2 rows = 3, table3 rows = 2, the big table will have 10 entries.</p>
  
  <p>I can accomplish this by using a query like this:</p>
  
  <pre><code>SELECT A, B, Col1, Col2, null as Col3, null as Col4 FROM Table1
  UNION
  SELECT A, B, null as Col1, null as Col2, Col3, Col4 FROM Table2
  UNION
  SELECT A, B, Col1, Col2, null as Col3, Col4 FROM Table3
  </code></pre>
  
  <p>But I want to know if there is a better way to do this, because there will be more columns and more tables, and there is the possibility that all the columns are different.</p>