title: Laravel mysql union of multiple tables
body: <p>I have <strong>multiple <em>identical</em> mysql database tables</strong>. <br>
  What I need is a <strong>raw sql</strong> or <strong>Laravel schema</strong> to get the <strong>Union</strong> of all the tables in the database except the one's that are not identical.
  <br>I already tried the following code </p>
  
  <pre><code>$multipleUnion = DB::table('teble_1')-&gt;union(DB::table('teble_2')-&gt;union(DB::table('teble_3')))-&gt;get();
  </code></pre>
  
  <p>but I got this error</p>
  
  <blockquote>
    <p>SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select * from <code>table_3</code>))' at line 1 (SQL: (select * from <code>table_1</code>) union ((select * from <code>table_2</code>) union (select * from <code>table_3</code>)))</p>
  </blockquote>
  
  <p>I don't want to query like</p>
  
  <pre><code>SELECT * FROM table_1 UNION SELECT * FROM table_2 UNION SELECT * FROM table_3
  </code></pre>
  
  <p>Because the number of tables can increase as the time goes. 
  Thanks in Advance.</p>