[thelist] SQL: summing and counting the same field, based on value

Canfield, Joel JCanfield at PacAdvantage.org
Wed Jun 14 10:06:19 CDT 2006

> If, for efficiency reasons, you only want one query, compute both sum 
> and count for each grouping, and ignore the three extra 
> counts in your 
> data retrieval loop.  Otherwise, just use two queries.

yup; went with version one and fancy looping through my getrows array

just seeing if there was a different way to push this envelope; still
amazes me how often another evolter has a simple and elegant solution to
something I'm doing as above. just turns out in this case that this is
the best we get.

thanks all


More information about the thelist mailing list