I'm working on an aggregate query where I'd like to SUM not only a numeric field for grouped records, but also concatenate the values from a string field (with some separator like ', ') If I weren't using Access I know I could write a stored proc for this, but surely there's a standard SQL way of doing this?
The kind of thing I guess I'm after is something like:
SELECT TaskID, SUM(Days) as TotalEffort, STRSUM(WorkerName, ', ') as Workers From Effort GROUP BY TaskID
So that records like:
ID, TaskID, Days, WorkerName
1, 1, 3, Phil
2, 1, 4, Phil
3, 1, 1, John
4, 2, 2, Mike
5, 2, 1, Mike
6, 2, 2, John
would give:
TaskID, TotalEffort, Workers
1, 8, 'Phil, John'
2, 5, 'Mike, John'
Any clues?