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 -> Re: using the result of a partial sum in a where clause

Re: using the result of a partial sum in a where clause

From: Knut Talman <knut.talman_at_mytoys.de>
Date: Tue, 18 Jun 2002 19:53:57 +0200
Message-ID: <3D0F73B5.96C8AD04@mytoys.de>


"Adrián Garrido" wrote:
>
> 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).

Oracle version? And why should the query return 01/09/2002? All other dates past it also meet your requirement. Are you looking for the first date which has sum(value)>=parameter?

Regards,

Knut Received on Tue Jun 18 2002 - 12:53:57 CDT

Original text of this message

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