Hi. Can you post the SQL statement for your Totals Query? Also, what does the parameter prompt say?
Better still, as requested, what is the name of the parameter it is asking for?
Normally a misspelled name?
Hi. Try this:SELECT [T59 CS - Reimagine].[E Grouping], Sum([T59 CS - Reimagine].[CS Hrs]) AS [SumOfCS Hrs], [T59 B - Reimagine].[E Hrs], Sum([T59-AreaSuffixStore].BaseWeekHours) AS SumOfBaseWeekHours, ([SumOfBaseWeekHours]-[SumOfCS Hrs]) AS [E Hours Needed]
FROM ([T59 CS - Reimagine] INNER JOIN [T59 B - Reimagine] ON [T59 CS - Reimagine].[E Grouping] = [T59 B - Reimagine].[FLR Zone]) INNER JOIN [T59-AreaSuffixStore] ON [T59 CS - Reimagine].STASS = [T59-AreaSuffixStore].STASS
GROUP BY [T59 CS - Reimagine].[E Grouping], [T59 B - Reimagine].[E Hrs], ([SumOfBaseWeekHours]-[SumOfCS Hrs]);
SELECT [T59 CS - Reimagine].[E Grouping]
, Sum([T59 CS - Reimagine].[CS Hrs]) AS [SumOfCS Hrs]
, [T59 B - Reimagine].[E Hrs]
, Sum([T59-AreaSuffixStore].BaseWeekHours) AS SumOfBaseWeekHours
, ([SumOfBaseWeekHours]-[SumOfCS Hrs]) AS [E Hours Needed]
FROM ([T59 CS - Reimagine]
INNER JOIN [T59 B - Reimagine]
ON [T59 CS - Reimagine].[E Grouping] = [T59 B - Reimagine].[FLR Zone])
INNER JOIN [T59-AreaSuffixStore]
ON [T59 CS - Reimagine].STASS = [T59-AreaSuffixStore].STASS
GROUP BY [T59 CS - Reimagine].[E Grouping]
, [T59 B - Reimagine].[E Hrs]
, Sum([T59-AreaSuffixStore].BaseWeekHours)-[SumOfCS Hrs];
Hi. Try this:
(untested)Code:SELECT [T59 CS - Reimagine].[E Grouping] , Sum([T59 CS - Reimagine].[CS Hrs]) AS [SumOfCS Hrs] , [T59 B - Reimagine].[E Hrs] , Sum([T59-AreaSuffixStore].BaseWeekHours) AS SumOfBaseWeekHours , ([SumOfBaseWeekHours]-[SumOfCS Hrs]) AS [E Hours Needed] FROM ([T59 CS - Reimagine] INNER JOIN [T59 B - Reimagine] ON [T59 CS - Reimagine].[E Grouping] = [T59 B - Reimagine].[FLR Zone]) INNER JOIN [T59-AreaSuffixStore] ON [T59 CS - Reimagine].STASS = [T59-AreaSuffixStore].STASS GROUP BY [T59 CS - Reimagine].[E Grouping] , [T59 B - Reimagine].[E Hrs] , Sum([T59-AreaSuffixStore].BaseWeekHours)-[SumOfCS Hrs];
Are you able to post a copy of your db?I received a syntax error in the join operation.
(I am not SQL knowledge able so I am not sure how to resolve)
Are you able to post a copy of your db?
Hi. Try changing the GROUP BY clause to simply have the following:No, it is a bit massive and predates me. So I am working off of someone else's work.
I did resolve the syntax though. Now I have a "Cannot have aggregate function in Group By clause (Sum(([T59-AreaSuffixStore].BaseWeekHours)-[SumofCS Hrs])"
...GROUP BY [T59 CS - Reimagine].[E Grouping], [T59 B - Reimagine].[E Hrs]
Hi. Try changing the GROUP BY clause to simply have the following:
Code:...GROUP BY [T59 CS - Reimagine].[E Grouping], [T59 B - Reimagine].[E Hrs]
Hi. Can you post the new/updated SQL statement? Thanks.Thanks!
That did run it. But I am now getting a parameter message for "T59 CS - Reimagine.CS Hrs". It is also no longer returning values for "SumOfCS Hrs" or "E Hours Needed"
Hi. Can you post the new/updated SQL statement? Thanks.
Hi. Thanks. Unfortunately, I don't see anything obviously wrong with that. I think all the brackets are in the right places. Can you create a mockup db with only the table structure (no data) for the three tables concerned in this query and then post it?SELECT [T59 CS - Reimagine].[E Grouping], Sum([T59 CS - Reimagine].[CS Hrs]) AS [SumOfCS Hrs], [T59 B - Reimagine].[E Hrs], Sum([T59-AreaSuffixStore].BaseWeekHours) AS SumOfBaseWeekHours, ([SumOfBaseWeekHours]-[SumOfCS Hrs]) AS [E Hours Needed]
FROM ([T59 CS - Reimagine] INNER JOIN [T59 B - Reimagine] ON [T59 CS - Reimagine].[E Grouping] = [T59 B - Reimagine].[FLR Zone]) INNER JOIN [T59-AreaSuffixStore] ON [T59 CS - Reimagine].STASS = [T59-AreaSuffixStore].STASS
GROUP BY [T59 CS - Reimagine].[E Grouping], [T59 B - Reimagine].[E Hrs];
Hi. Thanks. Unfortunately, I don't see anything obviously wrong with that. I think all the brackets are in the right places. Can you create a mockup db with only the table structure (no data) for the three tables concerned in this query and then post it?
Hi. Thanks! Give this one a try.I have attached the tables and queries.
Hi. Thanks! Give this one a try.
Hi. You're welcome. Sometimes, it's easier to fix something when you can "touch" it. Glad we could assist. Good luck with your project.This seems to work.
THank you Thank you!!