Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select
Message
From
06/04/2010 12:40:50
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Select
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01458778
Message ID:
01458953
Views:
37
HI,

i get the same error,
i need this code to replace newtest.ty2010 with (AcrsYTD.YTD)


>>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 = NVL(YTD,0) ;
>         from NewTest inner join crsYTD YTD on NewTest.ID1 = NewTest.ID1 and NewTest.Name = crsYTD.Nam
>
>
>
>See the change I made here - used NVL function.
>
>Comment out this code bellow - why do you need it?
>
>>local lnRecNo
>>lnRecno = 1
>>select NewTest
>>scan 
>>if between(m.lnRecno, 1, reccount('crsYTD'))
>>
>>   goto lnRecno in crsYTD
>>   replace ty2010 with crsYTD.YTD &&error message Field "ty2010" does not accept null values 
>>   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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform