Union Select Failing

B

Bill Stanton

Just trying to concatenate two tables with like fields. I get
an error message:

"The SELECT statement includes a reserved word or an
argument name that is misspelled or missing, or the
punctuation in incorrect."

Both tables DonRegFamCk and DonRegFam$$ define fields:
FundID, Amount, DOE, FamilyID
where FundID is the ID of the fund title in table "Funds".

SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID],
FROM [DonRegFamCk] INNER JOIN [Funds],
ON [DonRegFamCk].[FundID] = [Funds].[FundID],
UNION SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID],
FROM [DonRegFam$$] INNER JOIN [Funds],
ON [DonRegFam$$].[FundID] = [Funds].[FundID];

What am I missing?

Thanks,
Bill Stanton
 
J

John Spencer (MVP)

If that is your exact code, nothing is missing. However, you do have MORE than
you need.

You have an extraneous comma before the ON in both sections of the query and
another comma before the UNION and another before the FROM in each section.

SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID]
FROM [DonRegFamCk] INNER JOIN [Funds]
ON [DonRegFamCk].[FundID] = [Funds].[FundID]
UNION
SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID]
FROM [DonRegFam$$] INNER JOIN [Funds]
 
B

Bill Stanton

Thanks John.
Bill


John Spencer (MVP) said:
If that is your exact code, nothing is missing. However, you do have MORE than
you need.

You have an extraneous comma before the ON in both sections of the query and
another comma before the UNION and another before the FROM in each section.

SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID]
FROM [DonRegFamCk] INNER JOIN [Funds]
ON [DonRegFamCk].[FundID] = [Funds].[FundID]
UNION
SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID]
FROM [DonRegFam$$] INNER JOIN [Funds]
Just trying to concatenate two tables with like fields. I get
an error message:

"The SELECT statement includes a reserved word or an
argument name that is misspelled or missing, or the
punctuation in incorrect."

Both tables DonRegFamCk and DonRegFam$$ define fields:
FundID, Amount, DOE, FamilyID
where FundID is the ID of the fund title in table "Funds".

SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID],
FROM [DonRegFamCk] INNER JOIN [Funds],
ON [DonRegFamCk].[FundID] = [Funds].[FundID],
UNION SELECT [Funds].[FundTitle],[Amount],[DOE],[FamilyID],
FROM [DonRegFam$$] INNER JOIN [Funds],
ON [DonRegFam$$].[FundID] = [Funds].[FundID];

What am I missing?

Thanks,
Bill Stanton
 

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

Similar Threads

Multi-UNION select 6
Special syntax for ORDER BY ????? 6
Problem joining queries 5
ACCOUNT SUMMARIES 1
Union query 5
Error in syntax 2
Need helps on my union query 3
Union with IIF - More issues 5

Top