By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,830 Members | 682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,830 IT Pros & Developers. It's quick & easy.

Union Query: Syntax Error

P: 1
I am attempting to combine 2 crosstab queries and I keep getting the "Syntax error in TRANSFORM statement".

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Sum(tblPlanSavings.[PlanSavings]) AS SumOfPlanSavings
  2. SELECT tblPlanSavings.[BusinessUnit], tblPlanSavings.[PlantName], tblPlanSavings.[Category], Sum(tblPlanSavings.[PlanSavings]) AS [Total Of PlanSavings]
  3. FROM tblPlanSavings
  4. GROUP BY tblPlanSavings.[BusinessUnit], tblPlanSavings.[PlantName], tblPlanSavings.[Category]
  5. PIVOT Format([MonthYear],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
  7. TRANSFORM Sum(qryProcurementPlantSavingsAllMonths.Savings) AS SumOfSavings
  8. SELECT qryProcurementPlantSavingsAllMonths.BusinessUnit, qryProcurementPlantSavingsAllMonths.PlantName, qryProcurementPlantSavingsAllMonths.Category, Sum(qryProcurementPlantSavingsAllMonths.Savings) AS [Total Of Savings]
  9. FROM qryProcurementPlantSavingsAllMonths
  10. GROUP BY qryProcurementPlantSavingsAllMonths.BusinessUnit, qryProcurementPlantSavingsAllMonths.PlantName, qryProcurementPlantSavingsAllMonths.Category
  11. PIVOT Format([MonthYear],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
Apr 5 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,357
Please use code tags when posting code.

Take the aggregate out of the SELECT clause.
Apr 5 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.