title: Error running SQL in MS-Access with ODBC connection to MYSQL
body: <p>I was helping a non-profit migrate MS-Access data to MYSQL. So, I ported data to MYSQL and created links in ms-access to MYSQL tables using ODBC. Majority of the existing SQL works fine. However I am stumped on this one error - </p>
  
  <p>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...</p>
  
  <p>I have stripped the SQL with 7 UNIONS to bare bones where it still fails.</p>
  
  <pre><code>(SELECT 1 as A FROM Households H)
  UNION ALL
  (SELECT 2 as A FROM Households H)
  UNION ALL
  (SELECT 3 as A FROM Households H)
  </code></pre>
  
  <p>The part that is getting to me is that I am able to run above successfully as long as I run only one UNION meaning below SQL, but the moment I add a third one, it gives ODBC error</p>
  
  <pre><code>(SELECT 1 as A FROM Households H)
  UNION ALL
  (SELECT 2 as A FROM Households H)
  </code></pre>
  
  <p>I tried using <strong>`</strong> or <strong>'</strong> or <strong>[]</strong> but none of these helped. The reason I am frustrated with this error is that either it should fail with all or none, it gives an error only when using two or more UNION clauses. Could this be a potential bug in driver?</p>
  
  <p>I am using mysql-64 bit on win-7 64bit with ms-access and a 32-bit driver. It shouldn't be an architecture problem as I am able to run other queries with multiple UNIONs, and accessing the same set of tables.</p>
  
  <p>It would be great if someone can give pointers on how to debug this further.</p>