Union Select Failing

  • Thread starter Thread starter Bill Stanton
  • Start date Start date
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
 
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]
 
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
 
Back
Top