[thelist] SQL aggregation ignorance

Canfield, Joel JCanfield at PacAdvantage.org
Thu Jul 20 13:06:05 CDT 2006

I can't fathom how to do this without multiple trips to the database,
which irks me.

For reports for our call center, I need to retrieve a recordset grouped
by Rep's Name, then by status, then by date. Results need to be
something like this:


I can't fathom how to get the results aggregated (counts, sums, and
averages) by date.

What I'm doing right now is looping through each name, getting the stats
for each status for each date. For a full month I'm running 253
individual queries (11 reps, 23 business days in May, for instance.)
It's so very wrong.

Somehow seems like grouping by DATEPART should be my answer, but the
thick film of sludge over my brain refuses to part.

thanks much


More information about the thelist mailing list