1

I am using MS Access 2010 and I have the following query

SELECT id FROM car

UNION

SELECT id FROM user

When I try to run it, Access says "ODBC-query failed. near "(": syntax error (1)(#1)". However as you can see, there is no single parenthesis in the query.

When I run the query in MySQL it works just fine. The tables are linked to from a sqlite source.

PS: Of course the original query which was much more complicated. But as I tried to reduce the error I ended up with this simple query which also doesn't work.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Luksurious
  • 991
  • 9
  • 15
  • Are the data types the same for ID in Car as they are in User? – Tim Lentine Oct 25 '12 at 15:39
  • yes. I found a similar problem here: http://stackoverflow.com/questions/8329513/sqlite-syntax-error-in-union-select-query-from-ms-access – Luksurious Oct 25 '12 at 16:50
  • 1
    I think the problem is using UNION while linking to external source tables. I've had similar problems in the past. Have you tried dumping the data into local staging tables and then unioning them together? – PowerUser Oct 25 '12 at 18:24
  • The thing is that some UNION queries work. This one works: http://pastebin.com/Bf2JjTAx , but when I remove the INNER JOIN it doesn't: http://pastebin.com/UDELPMH7 – Luksurious Oct 26 '12 at 10:30

0 Answers0