Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select
Message
From
05/04/2010 16:44:44
 
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:
01458822
Views:
22
hi,
Sorry the last code i send it works ,

i want to show how i get values monthly and replace ment at newtest.


i need to update just the newtest as what i ask before, thank you for code



>Sorry - it looks like you don't need to use SCAN in that code, but anyway, you lost me.
>
>Let's assume this structure
>
>GroupID         Month      Value        YTD (values we want to have)
>1               1            10          10   
>2               1            15          15 
>1               2            20          30
>2               2             5          20
>
>
>select T1.GroupID, (select sum(Value) from myTable T2 where T2.GroupID = T1.GroupID and T2.Month <=T1.Month ) as YTD 
>from myTable T1  
>
>
>>hi,
>>
>>evrye values for filelds partofname is 2009 it is old values just i used to compare ,
>>
>>but every month i fill(replace) the newtest form another table have 6 values via this code
>>
>>SET DELETED ON
>>USE newtest 
>>UPDATE newtest  SET y2010 = T.val1  from newtest  inner join hamad T on newtest.ID = T.ID WHERE id1=2
>>
>>UPDATE newtest SET PER1= (Y2010-Y2009)/Y2009 from newtest WHERE ID1=2
>>*brow
>>
>>***********************************************************************
>>scan
>>
>>SET FILTER TO  ID1=2 AND FLG=1
>>   SUM Y2010 TO M.D FOR id1=2
>>  
>>   
>>SET FILTER TO 
>>   REPLACE Y2010 WITH M.D FOR NAM="TOT1" AND id1=2
>>  
>>endscan
>>
>>scan
>>
>>SET FILTER TO  ID1=2 AND FLG=2
>>   SUM Y2010 TO M.D FOR id1=2
>>  
>>   
>>SET FILTER TO 
>>   REPLACE Y2010 WITH M.D FOR NAM="TOT2" AND id1=2
>>  endscan
>>
>>
>>scan
>>
>>SET FILTER TO  ID1=2 AND FLG=3
>>   SUM Y2010 TO M.D FOR id1=2
>>  
>>   
>>SET FILTER TO 
>>   REPLACE Y2010 WITH M.D FOR NAM="TOT3" AND id1=2
>> endscan
>>
>>
>>
>>
>>
>>>The output above was not really helpful. Do you match records by name? In other words, for each month you have many records. How do you match each month?
>>>
>>>>>
>>>>>>Field  Field Name      Type                Width    Dec   Index   Collate Nulls    Next    Step
>>>>>>    1  ID1             Numeric                 3                             No
>>>>>>    2  ID              Numeric                 2                             No
>>>>>>    3  NAM             Character              10                             No
>>>>>>    4  Y2009           Numeric                15      3                      No
>>>>>>    5  Y2010           Numeric                15      3                      No
>>>>>>    6  PER1            Numeric                15      3                      No
>>>>>>    7  TY2009          Numeric                15      3                      No
>>>>>>    8  TY2010          Numeric                15      3                      No
>>>>>>    9  TPER            Numeric                15      3                      No
>>>>>>   10  FLG             Numeric                 2                             No
>>>>>>** Total **                                  108
>>>>>
>>>>>
>>>>>Ok, and also some data (copy to 'temp.txt' delimited with tab)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform