Union Query Problem

S

Simon

I am trying to use a union query to join 4 table together

I have done the code but when it runs i get the following error


ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line 1
(#1064)


Can any one help me



If i if i split the Union query into 2 seperate ones they both work
fine, just have problems when i put them together
 
Y

Yumex85

Are you using access only as a front end and MySQL as your database?
Anyway, i could see it better if u post ur union query here.
I have one thing u could try tho, once i had i union query problem but
that time i was using access as front end and as database, the error
was different too, but i fixed the query writing it everything like
this :

select
.[column] from
where
.[column]
union..............etc etc

and it amazingly worked! dont ask me why i have no idea
.>
regards
yumi



What's the SQL you're trying to run?

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I am trying to use a union query to join 4 table together
I have done the code but when it runs i get the following error
ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line 1
(#1064)
Can any one help me
If i if i split the Union query into 2 seperate ones they both work
fine, just have problems when i put them together
 
S

Simon

Are you using access only as a front end and MySQL as your database?
Anyway, i could see it better if u post ur union query here.
I have one thing u could try tho, once i had i union query problem but
that time i was using access as front end and as database, the error
was different too, but i fixed the query writing it everything like
this :

select
.[column] from
where
.[column]
union..............etc etc

and it amazingly worked! dont ask me why i have no idea
.>
regards
yumi


What's the SQL you're trying to run?
I am trying to use a union query to join 4 table together
I have done the code but when it runs i get the following error
ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line 1
(#1064)
Can any one help me
If i if i split the Union query into 2 seperate ones they both work
fine, just have problems when i put them together- Hide quoted text -

- Show quoted text -


Below is my union query, and i am using access as front end

Thanks

SELECT qryHotTubsWS.[IDNumber] AS IDNumber,
qryHotTubsWS.[ProductName] AS ProductName,
qryHotTubsWS.[Price] AS Price,
qryHotTubsWS.[ProductCode] As ProductCode,
'qryHotTubsWS' AS TheType
FROM qryHotTubsWS



UNION ALL SELECT qryProductsWS.[IDNumber] AS IDNumber,
qryProductsWS.[ProductName] AS ProductName,
qryProductsWS.[Price] AS Price,
qryProductsWS.[ProductCode] AS ProductCode,
'qryProductWS' AS TheType
FROM qryProductsWS;



UNION ALL SELECT qryHotTubsProducts.[IDNumber] AS IDNumber,
qryHotTubProducts.[ProductName] AS ProductName,
qryHotTubsProducts.[TradePriceExVAT] AS Price,
qryHotTubsProducts.[ProductCode] As ProductCode,
'qryHotTubsProducts' AS TheType
FROM qryHotTubsProducts


UNION ALL SELECT qryExtrasWS.[IDNumber] AS IDNumber,
qryExtrasWS.[ProductName] AS ProductName,
qryExtrasWS.[Price] AS Price,
qryExtrasWS.[ProductCode] AS ProductCode,
'qryExtrasWS' AS TheType
FROM qryExtrasWS;
 
D

Douglas J. Steele

Since the error message you quoted mentions 'tblcodesWS' and
'tblProductsWS', neither of which appear in the query you've posted, I'm
wondering whether it's a problem with MySQL.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Simon said:
Are you using access only as a front end and MySQL as your database?
Anyway, i could see it better if u post ur union query here.
I have one thing u could try tho, once i had i union query problem but
that time i was using access as front end and as database, the error
was different too, but i fixed the query writing it everything like
this :

select
.[column] from
where
.[column]
union..............etc etc

and it amazingly worked! dont ask me why i have no idea
.>
regards
yumi


What's the SQL you're trying to run?
I am trying to use a union query to join 4 table together
I have done the code but when it runs i get the following error
ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line 1
(#1064)
Can any one help me
If i if i split the Union query into 2 seperate ones they both work
fine, just have problems when i put them together- Hide quoted text -

- Show quoted text -


Below is my union query, and i am using access as front end

Thanks

SELECT qryHotTubsWS.[IDNumber] AS IDNumber,
qryHotTubsWS.[ProductName] AS ProductName,
qryHotTubsWS.[Price] AS Price,
qryHotTubsWS.[ProductCode] As ProductCode,
'qryHotTubsWS' AS TheType
FROM qryHotTubsWS



UNION ALL SELECT qryProductsWS.[IDNumber] AS IDNumber,
qryProductsWS.[ProductName] AS ProductName,
qryProductsWS.[Price] AS Price,
qryProductsWS.[ProductCode] AS ProductCode,
'qryProductWS' AS TheType
FROM qryProductsWS;



UNION ALL SELECT qryHotTubsProducts.[IDNumber] AS IDNumber,
qryHotTubProducts.[ProductName] AS ProductName,
qryHotTubsProducts.[TradePriceExVAT] AS Price,
qryHotTubsProducts.[ProductCode] As ProductCode,
'qryHotTubsProducts' AS TheType
FROM qryHotTubsProducts


UNION ALL SELECT qryExtrasWS.[IDNumber] AS IDNumber,
qryExtrasWS.[ProductName] AS ProductName,
qryExtrasWS.[Price] AS Price,
qryExtrasWS.[ProductCode] AS ProductCode,
'qryExtrasWS' AS TheType
FROM qryExtrasWS;
 
S

Simon

Since the error message you quoted mentions 'tblcodesWS' and
'tblProductsWS', neither of which appear in the query you've posted, I'm
wondering whether it's a problem with MySQL.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)




Are you using access only as a front end and MySQL as your database?
Anyway, i could see it better if u post ur union query here.
I have one thing u could try tho, once i had i union query problem but
that time i was using access as front end and as database, the error
was different too, but i fixed the query writing it everything like
this :
select
.[column] from
where
.[column]
union..............etc etc
and it amazingly worked! dont ask me why i have no idea
.>
regards
yumi
On 18 maio, 09:45, "Douglas J. Steele"
What's the SQL you're trying to run?
--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)

I am trying to use a union query to join 4 table together
I have done the code but when it runs i get the following error
ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line 1
(#1064)
Can any one help me
If i if i split the Union query into 2 seperate ones they both work
fine, just have problems when i put them together- Hide quoted text -
- Show quoted text -
Below is my union query, and i am using access as front end

SELECT qryHotTubsWS.[IDNumber] AS IDNumber,
qryHotTubsWS.[ProductName] AS ProductName,
qryHotTubsWS.[Price] AS Price,
qryHotTubsWS.[ProductCode] As ProductCode,
'qryHotTubsWS' AS TheType
FROM qryHotTubsWS
UNION ALL SELECT qryProductsWS.[IDNumber] AS IDNumber,
qryProductsWS.[ProductName] AS ProductName,
qryProductsWS.[Price] AS Price,
qryProductsWS.[ProductCode] AS ProductCode,
'qryProductWS' AS TheType
FROM qryProductsWS;
UNION ALL SELECT qryHotTubsProducts.[IDNumber] AS IDNumber,
qryHotTubProducts.[ProductName] AS ProductName,
qryHotTubsProducts.[TradePriceExVAT] AS Price,
qryHotTubsProducts.[ProductCode] As ProductCode,
'qryHotTubsProducts' AS TheType
FROM qryHotTubsProducts
UNION ALL SELECT qryExtrasWS.[IDNumber] AS IDNumber,
qryExtrasWS.[ProductName] AS ProductName,
qryExtrasWS.[Price] AS Price,
qryExtrasWS.[ProductCode] AS ProductCode,
'qryExtrasWS' AS TheType
FROM qryExtrasWS;- Hide quoted text -

- Show quoted text -


Any idea what could be causing this problem in my sql
 
D

Douglas J. Steele

SInce I know nothing about MySQL, I'd recommend finding a newsgroup related
to that product, such as comp.databases.mysql

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Simon said:
Since the error message you quoted mentions 'tblcodesWS' and
'tblProductsWS', neither of which appear in the query you've posted, I'm
wondering whether it's a problem with MySQL.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)




Are you using access only as a front end and MySQL as your database?
Anyway, i could see it better if u post ur union query here.
I have one thing u could try tho, once i had i union query problem but
that time i was using access as front end and as database, the error
was different too, but i fixed the query writing it everything like
this :
select
.[column] from
where
.[column]
union..............etc etc
and it amazingly worked! dont ask me why i have no idea


On 18 maio, 09:45, "Douglas J. Steele"
What's the SQL you're trying to run?
I am trying to use a union query to join 4 table together
I have done the code but when it runs i get the following error
ODBC - Call Failed
[MySQL][ODBC3.51 Driver][mysql-4.1.22-standard] 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
'tblcodesWS' , 'tblProductsWS' , 'ProductName' , ' tblPr' at line
1
(#1064)
Can any one help me
If i if i split the Union query into 2 seperate ones they both
work
fine, just have problems when i put them together- Hide quoted
text -
- Show quoted text -
Below is my union query, and i am using access as front end

SELECT qryHotTubsWS.[IDNumber] AS IDNumber,
qryHotTubsWS.[ProductName] AS ProductName,
qryHotTubsWS.[Price] AS Price,
qryHotTubsWS.[ProductCode] As ProductCode,
'qryHotTubsWS' AS TheType
FROM qryHotTubsWS
UNION ALL SELECT qryProductsWS.[IDNumber] AS IDNumber,
qryProductsWS.[ProductName] AS ProductName,
qryProductsWS.[Price] AS Price,
qryProductsWS.[ProductCode] AS ProductCode,
'qryProductWS' AS TheType
FROM qryProductsWS;
UNION ALL SELECT qryHotTubsProducts.[IDNumber] AS IDNumber,
qryHotTubProducts.[ProductName] AS ProductName,
qryHotTubsProducts.[TradePriceExVAT] AS Price,
qryHotTubsProducts.[ProductCode] As ProductCode,
'qryHotTubsProducts' AS TheType
FROM qryHotTubsProducts
UNION ALL SELECT qryExtrasWS.[IDNumber] AS IDNumber,
qryExtrasWS.[ProductName] AS ProductName,
qryExtrasWS.[Price] AS Price,
qryExtrasWS.[ProductCode] AS ProductCode,
'qryExtrasWS' AS TheType
FROM qryExtrasWS;- Hide quoted text -

- Show quoted text -


Any idea what could be causing this problem in my sql
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top