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

Home -> Community -> Usenet -> c.d.o.misc -> using the result of a partial sum in a where clause

using the result of a partial sum in a where clause

From: Adrián Garrido <agarrido_at_memory-set.es>
Date: Tue, 18 Jun 2002 19:17:09 +0200
Message-ID: <aenptr$ntu$1@nsnmrro2-gest.nuria.telefonica-data.net>


Hi

I have a table like this:

Date                    Value
01/01/2002          1
01/07/2002          3
01/09/2002          2
02/03/2002          9
03/10/2002          5

I want to get the date in wich the sum of its asigned value and its predecesors is greater or equal than a supplied parameter. For example, if the parameter = 5, the query should return 01/09/2002, (1 + 3 + 2 > 5).

It can be done easily with a explicit cursor but, can a standard sql query be used?

Thanks in advance
Adrián Garrido Received on Tue Jun 18 2002 - 12:17:09 CDT

Original text of this message

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