Syntax error in union query

  • Thread starter fhurman via AccessMonster.com
  • Start date
F

fhurman via AccessMonster.com

Hello, I have the following code in an SQL statement (pulling from one table)
and I'm getting a Syntax error in Union query message. Any help please?

Thanks in advance.

SELECT [Sales & Chargebacks by customer].[Prod Family Name], Sum([Sales &
Chargebacks by customer].[Invoice Sales]) AS [Invoice Sales], Sum([Sales &
Chargebacks by customer].[Invoice Sales Qty]) AS [Invoice Sales Qty] INTO
[TEMP Gross Sales] FROM [Sales & Chargebacks by customer] WHERE (([Sales &
Chargebacks by customer].[Fiscal year/period]) >= #1/1/2001# And ([Sales &
Chargebacks by customer].[Fiscal year/period]) <= #12/31/2003#) GROUP BY
[Sales & Chargebacks by customer].[Prod Family Name] HAVING (([Sales &
Chargebacks by customer].[Prod Family Name])='klonopin wafers')
 
J

Jerry Whittle

Is [Sales & Chargebacks by customer] a Union query? If so does it run OK
directly?

What happens when you run it as just a Select query?

Also I've never encountered a simple SQL statement with both a HAVING and
WHERE clauses. Is there another way to write it?
 
F

fhurman via AccessMonster.com

I got this code from the Select query and it ran there. The Sales &
Chargebacks by customer is just a table. Like I said there's only 1 table
involved here. That's why I was surprised to see a Union error.

Thanks for your help.


Jerry said:
Is [Sales & Chargebacks by customer] a Union query? If so does it run OK
directly?

What happens when you run it as just a Select query?

Also I've never encountered a simple SQL statement with both a HAVING and
WHERE clauses. Is there another way to write it?
Hello, I have the following code in an SQL statement (pulling from one table)
and I'm getting a Syntax error in Union query message. Any help please?
[quoted text clipped - 9 lines]
[Sales & Chargebacks by customer].[Prod Family Name] HAVING (([Sales &
Chargebacks by customer].[Prod Family Name])='klonopin wafers')
 

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


Top