Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan
Message
From
29/03/2010 07:58:11
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Scan
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01457705
Message ID:
01457795
Views:
36
thank you so much,
i try as below it works
CLOSE ALL
UPDATE Test Set NEW1 = T.incTax + T.AddTax, NEW2 = T.PentTot ,new3=new1+new2 from Test inner join Table1 T on Test.ID = T.ID

   SUM NEW3 TO M.D FOR flg=1
    SUM NEW3 TO M.D1 FOR flg=2
     SUM NEW3 TO M.D3 FOR flg=3

   
  replace new3 WITH m.d FOR nam="TOT1                          "
  replace new3 WITH m.d1 FOR nam="TOT2                          "
  replace new3 WITH m.d3 FOR nam="TOT3                          "
  replace new3 WITH m.d+m.d1+m.d3 FOR nam="TOTAL1                        "
brow
>Do you need running totals or just a regular replace (update)? If the later, then just use a single update command.
>
>>i need to replace new values at table test,
>>i try via previous code
>>
>>i get only first value from table1 and i stuk at infint loop&& sorry for english words,
>>
>>i need your help to fix the previous bad code
>>
>>thanks
>>
>>>Do you need to solve running total query? If yes, then indeed you need to use scan loop.
>>>
>>>>thank you for reply
>>>>i add for the 2 tables field id and your code it works
>>>>
>>>>but i need to run it as below
>>>>
>>>>clea
>>>>CLOSE all
>>>>USE table1 IN 0
>>>>SCAN
>>>>m.tot=inctax+addtax
>>>>m.penttot=penttot
>>>>
>>>>USE test IN 0
>>>>
>>>>IF  nam="tot1"
>>>>   SUM y2010 TO m.q
>>>>       REPLACE y2010 WITH m.q FOR nam="tot1"
>>>>      
>>>>       
>>>>else       
>>>>   replace test.y2010 WITH m.tot
>>>>   REPLACE test.column6 WITH m.penttot 
>>>>endif 
>>>>
>>>>IF  nam="tot2"
>>>>   SUM y2010 TO m.q
>>>>       REPLACE y2010 WITH m.q FOR nam="tot2"
>>>>else       
>>>>   replace test.y2010 WITH m.tot
>>>> REPLACE test.column6 WITH m.penttot 
>>>>endif 
>>>>
>>>>IF  nam="tot3"
>>>>   SUM y2010 TO m.q
>>>>       REPLACE test.y2010 WITH m.q FOR nam="tot3"
>>>>       m.total=tot1+tot2+tot3
>>>>       REPLACE test.total WITH m.total
>>>>       
>>>>else       
>>>>    replace test.y2010 WITH m.tot
>>>>    REPLACE test.column6 WITH m.penttot 
>>>>endif 
>>>>
>>>>
>>>>endscan  
>>>>
>>>>
>>>>thanks
>>>>
>>>>>>hi all,
>>>>>>
>>>>>>i need help to get next value from table1 via this code below
>>>>>>
>>>>>>
>>>>>>USE table1 
>>>>>>   m.tot=inctax+addtax
>>>>>>   m.penttot=penttot
>>>>>>
>>>>>>USE test
>>>>>>Select test
>>>>>>SCAN
>>>>>>   replace y2010 with m.tot
>>>>>>   replace column6 with m.penttot 
>>>>>>   
>>>>>>**USE table1&&not work
>>>>>>
>>>>>>ENDSCAN
>>>>>>
>>>>>>thanks
>>>>>
>>>>>How these two tables (Test and Table1) are related?
>>>>>
>>>>>May be you can do just one update command, e.g.
>>>>>
>>>>>UPDATE Test Set y2010 = T.incTax + T.AddTax, ;
>>>>>                  Column6 = T.PentTot 
>>>>>                  from Test inner join Table1 T on Test.ID = T.ID
Previous
Reply
Map
View

Click here to load this message in the networking platform