Union Make Table Query

M

Matt

I have the following SQL for a Union Make table query.

SELECT Combine UNION Header-Detail.*, [UnionHeaderXT].
[AUTH_NUM] INTO mktbl_UnionHeaderDetailXT FROM [Combine
Union Header-Detail] LEFT JOIN UnionHeaderXT ON [Combine
Union Header-Detail].[ORD_NUM]=[UnionHeaderXT].
[ORDER_NUM];

I get the following error message when I attempt to run
it... "Query input must contain at least one table or
query."
Does anyone know the cause of this error. Any help is
greatly appreciated. Thanks, Matt.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Correct syntax for a UNION query is:

SELECT ... column names
FROM table name
WHERE ... criteria

UNION -- or UNION ALL

SELECT ... column names
FROM table name
WHERE ... criteria

It looks like you might be more interested in this solution:

SELECT Header-Detail.*, [UnionHeaderXT].[AUTH_NUM] INTO
mktbl_UnionHeaderDetailXT
FROM [Combine Union Header-Detail] LEFT JOIN UnionHeaderXT ON [Combine
Union Header-Detail].[ORD_NUM]=[UnionHeaderXT].[ORDER_NUM]

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQS+PbIechKqOuFEgEQKNPwCfdIUjJfIbVlyuYnAXpBujNDnioZIAoPZF
Ut4x+CusBpsyyHOAViGeU4cG
=LRBX
-----END PGP SIGNATURE-----
 
T

Ted Allen

If you meant for your query to be a UNION query, I think
the post from MGFoster should resolve your problem. But,
in reading your post it looked to me like you are
possibly trying to create a select query that pulls data
from a union query as well as another table or query. If
that is the case, I think that the problem may simply be
that the name of the union query is not enclosed in []'s
in the select statement, so sql is interpreting the word
union in the query name as the UNION keyword. Try
changing:

SELECT Combine UNION Header-Detail.*, etc

to,

SELECT [Combine Union Header-Detail].*, etc

HTH,

Ted Allen
 

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