select ebalance,sum(ebalance) over(partition by fnbr) as total,fnbr,cdate,
(case when bb=0 then 0 else sum(ebalance) over(partition by fnbr order by cdate
(select sum(ebalance) as bb from mmfclientbalance
where trunc(cdate) = (select max(trunc(cdate))
where trunc(cdate) < to_date('Dec 19, 2002','Mon dd, yyyy')
AND cid= '10189'AND aNbr = '10000000000000000187'))bbal
BETWEEN to_date('Dec 19, 2002','Mon dd, yyyy') AND to_date('Dec 21, 2002','Mon dd, yyyy')
and cid= '10189'
AND aNbr = '10000000000000000187'
iwant the above qry to return the values as follows that is between 19 and 21 data to be summed up in a cumulated manner
if no data is there in date of that column then it has to forward the previous balance.that is for eg.
for 102 21-dec-02 balance is 100000 no 19 or 20 is there so before this date any record is there with ebalance it has
to forward and summed up thatis i have 18 dec 200000 + 21-dec 100000 to be 300000. next with fnbr for 103 19 dec300000 is
there it has to forward to 20 dec 21 4000000 ihave that is i should get the sum cumulatevely as 10,00,000 for fnbr 103 and so
on how can we write this qry i tried with all analytical functions but iam not getting can u plz tell me.