Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: multiply column values within a partition
On 2005-05-03, Ora <webuser007_at_gmail.com> wrote:
> Hello,
>
> Is there a PRODUCT() OVER() equivalent to SUM() OVER() analytical
> function which can help me with the query output below?
>
> In Oracle 9.2.x, given the following source data, how could I get the
> output shown, using SQL (no plsql).
>
> Source Data:
> c1 c2 c3
> ---------------------
> abc jan 10
> abc feb 20
> abc mar 30
> def jan -40
> def feb 0
> def mar -50
>
> Desired Output (with new c4 calculated column):
> c1 c2 c3 c4
> -----------------------------------------------
> abc jan 10 200 -- 10*20
> abc feb 20 600 -- 20*30
> abc mar 30 -1200 -- 30*-40
> def jan -40 2000 -- -40*-50
> def feb -50 0 -- -50*0
> def mar 0 0
it looks like like you could achieve the desired output with lag() over() or lead() over().
hth
Rene
-- Rene Nyffenegger http://www.adp-gmbh.ch/Received on Tue May 03 2005 - 13:48:19 CDT
![]() |
![]() |