HI,
i try add newfileld T.ID # 0 as below i get error message Field "ty2010" does not accept null values
and i need to T1.Nam = T.Nam get exactly nam , i try set exact on and == but not work
select T.ID,T.Nam, T.ID1, (select sum(Y2010) as YTD from NewTest T1 WHERE T1.ID#0 AND T1.Nam = T.Nam and T1.ID1 <= T.ID1 ) as YTD from ;
NewTest T into cursor crsYTD
update NewTest set ty2010 = YTD ;
from NewTest inner join crsYTD YTD on NewTest.ID1 = NewTest.ID1
local lnRecNo
lnRecno = 1
select NewTest
scan
if between(m.lnRecno, 1, reccount('crsYTD'))
goto lnRecno in crsYTD
replace ty2010 with crsYTD.YTD
endif
lnRecno = lnRecno + 1
ENDSCAN
thanks
>>Is Name + Month combination unique? yes
>>And each Name repeats for each month?yes
>
>One approach - not good performance
>
> select T.Nam, T.ID1, (select sum(Y2010) as YTD from NewTest T1 where T1.Nam = T.Name and T1.ID1 <= T.ID1) as YTD from
> NewTest T into cursor crsYTD
>
>Second approach I already wrote in my other message - use scan and intermediate cursor.