GroupBy to get subtotals

Posts   
 
    
gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 30-Dec-2008 20:19:07   

Hi folks,

(Fictional example, and I think it's one of the oldest (and probably mostly solved) actions of the book, but I couldn't find the right terminology to search on.)

I have a selection of Orders of which I would like to display a total summary.

For example Order 1 consists of: Product A - 3x Product B - 2x

Order 2 consists of: Product B - 5x Product C - 2x

My Summary would be: Product A - 3x Product B - 7x Product C - 2x

It's there any way to solve this in a gentle way, instead of retrieving all order items and sum them in memory, of for example find out which products are used and in this case perform 3 scalar functions.

Any input or links to other threads are more than welcome,

Thanks.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 30-Dec-2008 21:28:50   

Hi

Please see the sections in the manual on creating dynamic lists and aggregate functions

Matt