SELECT T.Segment, T.SBU, T.Division, T.Operation, T.[Business Unit],
T.Team, T.[Product Category], T.Product, T.[Additional Info], T.[User ID], T.[User Contact Name and BP ID],
T.Email, T.[Staff Number], T.[Work Order], T.[Asset Tag], T.[Job Recovery Code], T.[Service Start Date],
T.[Service End Date], T.[Start Month], T.[End Month], T.[RFS Opener], T.[RFS Closer],
T.[Previous Year Ref Figure (March)], T.April, T.May, T.June, T.July, T.August, T.September,
T.October, T.November, T.December, T.January, T.February, T.March, T.[April Delta],
T.[May Delta], T.[June Delta], T.[July Delta], T.[August Delta], T.[September Delta],
T.[October Delta], T.[November Delta], T.[December Delta], T.[January Delta], T.[February Delta], T.[March Delta], Sum(T.[Year to Date])
FROM `D:\GRoup IS Billing\Group IS Billing`.`'Delta Report Data$'` T
Group By T.Segment, T.SBU, T.Division, T.Operation, T.[Business Unit],
T.Team, T.[Product Category], T.Product, T.[Additional Info], T.[User ID], T.[User Contact Name and BP ID],
T.Email, T.[Staff Number], T.[Work Order], T.[Asset Tag], T.[Job Recovery Code], T.[Service Start Date],
T.[Service End Date], T.[Start Month], T.[End Month], T.[RFS Opener], T.[RFS Closer],
T.[Previous Year Ref Figure (March)], T.April, T.May, T.June, T.July, T.August, T.September,
T.October, T.November, T.December, T.January, T.February, T.March, T.[April Delta],
T.[May Delta], T.[June Delta], T.[July Delta], T.[August Delta], T.[September Delta],
T.[October Delta], T.[November Delta], T.[December Delta], T.[January Delta], T.[February Delta], T.[March Delta]
You need to include every field in the GROUP BY clause that isn't an aggregate function (ie the SUM() field is the only one you leave out of the group by). Also, whilst Excel records field names with spaces in ``, these often cause errors once a manual amendment is made to the SQL (hence I've replaced with [] brackets). Since you only have one table (ie there are no joins in the query) you don't actually need to prefix each field with the table name (ie `'Delta Report Data$'`) however, I have retained this, but used an alias of T instead (it's easier and shorter to read).
Bookmarks