new type of aggregate function (product function) 
Author Message
 new type of aggregate function (product function)

Just in the way one can use sum, avg, count etc.. as
aggregate functions in a query, I am trying to create
a "product" function.  (one that multiplies the numbers
across a domain).  So, for example:

id  number
232      2
232      3
232      2
876      3
876      1
876      7

would result:

id     number
232      12
876      21

thanks in advance...

--Andre



Sat, 31 Jul 2004 03:50:10 GMT  
 new type of aggregate function (product function)
Where's Duane when you need him?

To answer the question, just apply a math equivalent using an
expression like:

Exp(Sum(Log([number]))) AS product

On Mon, 11 Feb 2002 11:50:10 -0800, "Andre"

Quote:

>Just in the way one can use sum, avg, count etc.. as
>aggregate functions in a query, I am trying to create
>a "product" function.  (one that multiplies the numbers
>across a domain).  So, for example:

>id  number
>232      2
>232      3
>232      2
>876      3
>876      1
>876      7

>would result:

>id     number
>232      12
>876      21

>thanks in advance...

>--Andre



Sat, 31 Jul 2004 04:08:33 GMT  
 new type of aggregate function (product function)
Oh man, I shoulda know that!!   Thanks Marshall.

Quote:
>-----Original Message-----
>Where's Duane when you need him?

>To answer the question, just apply a math equivalent
using an
>expression like:

>Exp(Sum(Log([number]))) AS product

>On Mon, 11 Feb 2002 11:50:10 -0800, "Andre"

>>Just in the way one can use sum, avg, count etc.. as
>>aggregate functions in a query, I am trying to create
>>a "product" function.  (one that multiplies the numbers
>>across a domain).  So, for example:

>>id  number
>>232      2
>>232      3
>>232      2
>>876      3
>>876      1
>>876      7

>>would result:

>>id     number
>>232      12
>>876      21

>>thanks in advance...

>>--Andre

>.



Sat, 31 Jul 2004 04:30:03 GMT  
 new type of aggregate function (product function)

Marsh

You may be too fast for Duane.

Actually, I prefer a slight modification in this case to ensure the Values
are whole numbers, not decimals.

CLng( Exp( Sum( Log( [number] ) ) ) ) AS Product

Cheers
Van


Quote:
> Where's Duane when you need him?

> To answer the question, just apply a math equivalent using an
> expression like:

> Exp(Sum(Log([number]))) AS product

> On Mon, 11 Feb 2002 11:50:10 -0800, "Andre"

> >Just in the way one can use sum, avg, count etc.. as
> >aggregate functions in a query, I am trying to create
> >a "product" function.  (one that multiplies the numbers
> >across a domain).  So, for example:

> >id  number
> >232      2
> >232      3
> >232      2
> >876      3
> >876      1
> >876      7

> >would result:

> >id     number
> >232      12
> >876      21

> >thanks in advance...

> >--Andre



Sat, 31 Jul 2004 07:58:00 GMT  
 new type of aggregate function (product function)
That's a good idea Van, especially considering how much floating point
is going on in there.

Marsh

On Tue, 12 Feb 2002 10:58:00 +1100, "Van T. Dinh"

Quote:

>Actually, I prefer a slight modification in this case to ensure the Values
>are whole numbers, not decimals.

>CLng( Exp( Sum( Log( [number] ) ) ) ) AS Product



>> Where's Duane when you need him?

>> To answer the question, just apply a math equivalent using an
>> expression like:

>> Exp(Sum(Log([number]))) AS product

>> On Mon, 11 Feb 2002 11:50:10 -0800, "Andre"

>> >Just in the way one can use sum, avg, count etc.. as
>> >aggregate functions in a query, I am trying to create
>> >a "product" function.  (one that multiplies the numbers
>> >across a domain).  So, for example:

>> >id  number
>> >232      2
>> >232      3
>> >232      2
>> >876      3
>> >876      1
>> >876      7

>> >would result:

>> >id     number
>> >232      12
>> >876      21



Sat, 31 Jul 2004 11:44:45 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Aggregate product function?

2. Custom aggregate function

3. Aggregate functions

4. Domain Aggregate Function problem

5. Domain Aggregate function to return Collection/array

6. Help coding an aggregate dSum function

7. Aggregate function for values of fields in record

8. creating custom aggregate functions

9. Determine if SQL-Aggregate functions are ready

10. DAO didn't recognize Domain Aggregate functions

11. Custom Aggregate Function Brainwave?

12. is it possible to write aggregate functions

 

 
Powered by phpBB® Forum Software