Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Retrive values from different rows

Re: Retrive values from different rows

From: <sviluppo.sw_at_gmail.com>
Date: Sun, 17 Jun 2007 13:45:29 -0700
Message-ID: <1182113129.326466.111180@u2g2000hsc.googlegroups.com>


On 17 Giu, 17:30, sybra..._at_hccnet.nl wrote:
> On Sun, 17 Jun 2007 07:27:12 -0700, sviluppo..._at_gmail.com wrote:
> >Hi,
> >I've this intriguing problem.
>
> >>From a table like this
> >ID ART QTA REASON
> >1 A 10 W
> >2 A -2 C
> >3 A 3 PO
> >4 A -4 C
> >5 B 5 W
> >6 B -2 C
> >7 B -4 C
> >8 B 5 PO
> >9 C 5 W
> >10 D 7 W
> >11 ... ... ...
> >12 ... ... ...
>
> >where:
> >W=stock level
> >C=consuption
> >PO=purchase order
>
> >I want to obtain a new column VAL with the, so called, "dynamic-
> >whareouse".
> >The value in the VAL column must be equal to QTA when reason is W.
> >In the other cases, the value of VAL must be
> >the sum of the value of VAL in the n-1row and the QTA value of the
> >the n row.
>
> >In other words this must be the result:
> >ID ART QTA REASON VAL
> >1 A 10 W 10
> >2 A -2 C 8
> >3 A 3 PO 11
> >4 A -4 C 7
> >5 B 5 W 5
> >6 B -2 C 3
> >7 B -4 C -1
> >8 B 5 PO 4
> >9 C 5 W 5
> >10 D 7 W 7
> >11 ... ... ... ...
> >12 ... ... ... ...
>
> >It' esay by Excel but I've not found any way inOracle(9i).
> >Can someone help me?
> >Thanks in advance
> >Marco
>
> Look into analytic functions, particularly theLAGfunction.
>
> --
> Sybrand Bakker
> SeniorOracleDBA- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -

It's a new function fro me: tanks for your quick answer. It probably can help me, but I guess it's only a step forward to find the solution... Received on Sun Jun 17 2007 - 15:45:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US