When I discussed a case this morning where we need a kind of least common
multiple of some values, I came to realize that nearly no relational dbms
has a "product" aggregation function while all have "sum" available.
In our case, this was not a real issue, as we are assuming a value from
between 3 and 10 records to be multiplied, and doing the multiplication in
a cursor in a stored function does not need a lot of code, and is not
performance critical as well.
But to me it appears strange there does not seem to be more business
requirement for this. DOes averybody just sum numbers, and never multiply?
And obviously there is a bit more potential for overflow when multiplying
huge data sets than when summing them.
Maybe these are the reasons why nobody implements this?
What do you think?
From: "Frank Ploessel" <fpl...@d_e.i_m_s_h_e_a_l_t_h.c_o_m>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
User-Agent: Opera Mail/9.21 (Win32)
Date: 23 Oct 2007 10:39:54 -0700
X-Trace: forums-1-dub 1193161194 126.96.36.199 (23 Oct 2007 10:39:54 -0700)
X-Original-Trace: 23 Oct 2007 10:39:54 -0700, mail.taskarena-software-engineering.net
Xref: forums-1-dub sybase.public.sqlanywhere:44
Article PK: 866499
Subject: Re: "Product" aggregation function
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Date: 23 Oct 2007 11:03:08 -0700
X-Trace: forums-1-dub 1193162588 10.25.106.45 (23 Oct 2007 11:03:08 -0700)
X-Original-Trace: 23 Oct 2007 11:03:08 -0700, iarouter.sybase.com
Xref: forums-1-dub sybase.public.sqlanywhere:45
Article PK: 866500
I don't have answers offhand to your questions below, Frank, but you can
simulate the product() aggregate in SA using something like the following:
SELECT POWER(10, SUM(LOG10(c1)))
The work around above has been discussed in many other articles available on
I don't believe we have had many, if any, customer requests in the past for
adding a native product() aggregate.
Query Processing, SQL Anywhere R&D