Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: using the result of a partial sum in a where clause
"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
![]() |
![]() |