I have a sql statement with 2 SELECT statements combined with the keyword UNION. Something like this
SELECT a, b
FROM ... WHERE ...
UNION
SELECT c, d
FROM ... WHERE ...
If i execute this in the Query Analizer everything works fine and i get the results. But if i execute this through Visual Basic (with database.OpenRecordSet(sql) ) i get following error message:
The Microsoft Jet database engine cannot find the input table or query ... Make sure it exists and that its name is spelled correctly.
If i execute the first part of this combined query in VB (e.g. SELECT a, b FROM ... WHERE ...), no errors occur. The same with the second part.
I find it really strange and any hints and tips are welcome!
thanks in advance.Make sure you specify dbname..table. A different database may be your default via odbc or whatever you are using to connect through VB.|||Thx for the suggestion, but i already tried that one and unfortunately it doesn't solve the problem
Someone other hints, tips, tricks,...?sql
Showing posts with label dfrom. Show all posts
Showing posts with label dfrom. Show all posts
Friday, March 30, 2012
Problems with UNION-query
Labels:
bfrom,
combined,
database,
dfrom,
keyword,
microsoft,
mysql,
oracle,
select,
server,
sql,
statement,
statements,
thisselect,
union,
union-query,
unionselect
Subscribe to:
Posts (Atom)