Reputation: 11
I am using this query and it is working perfect but in excel as a database, it is giving me an error of aggregate function - solution: once I add all column in the group by I don't get sum and Group by doesn't work.
select ColA,ColB,ColC,ColdD,SUM(ColE),ColF,ColG FROM automate GROUP BY ColA
One picture indicates table structure:
Another one is expected output:
Please help me if someone knows- MS-Access / excel as database
Upvotes: 0
Views: 35
Reputation: 3351
Every field in your SELECT
part must be either GROUPed BY
or aggregated. If all values are guaranteed to be the same or if you don't care which value will be picked use FIRST()
, otherwise use the appropriate aggregate function (MIN, MAX, FIRST, LAST, SUM, etc.)
Example:
SELECT ColA, FIRST(ColB), FIRST(ColC), FIRST(ColdD), SUM(ColE), FIRST(ColF), FIRST(ColG) FROM automate GROUP BY ColA
Upvotes: 0