title: UNION ALL query: "Too Many Fields Defined"
body: <p>I'm trying to get a UNION of 3 tables, each of which have 97 fields.  I've tried the following:</p>
  
  <pre><code>select * from table1
  union all
  select * from table2
  union all
  select * from table3
  </code></pre>
  
  <p>This gives me an error message:</p>
  
  <pre><code>Too many fields defined.
  </code></pre>
  
  <p>I also tried explicitly selecting all the field names from the first table (ellipses added for brevity):</p>
  
  <pre><code>select [field1],[field2]...[field97] from table1
  union all
  select * from table2
  union all
  select * from table3
  </code></pre>
  
  <p>It works fine when I only UNION two tables like this:</p>
  
  <pre><code>select * from table1
  union all
  select * from table2
  </code></pre>
  
  <p>I shouldn't end up with more than 97 fields as a result of this query; the two-table UNION only has 97.  So why am I getting <code>Too many fields</code> with 3 tables?</p>
  
  <p>EDIT: As RichardTheKiwi notes below, Access is summing up the field count of each SELECT query in the UNION chain, which means that my 3 tables exceed the 255 field maximum.  So instead, I need to write the query like this:</p>
  
  <pre><code>select * from table1
  union all
  select * from
  (select * from table2
  union all
  select * from table3)
  </code></pre>
  
  <p>which works fine.</p>