Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Growth percents
Message
 
To
11/03/2006 17:24:56
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01103467
Message ID:
01103513
Views:
18
>OK
>Please run the following code and look what you got:
>
create cursor mycursor (year i,saled i)
>insert into mycursor values (1999,1842)
>insert into mycursor values (2000,1914)
>insert into mycursor values (2001,1781)
>insert into mycursor values (2002,1987)
>insert into mycursor values (2003,2151)
>insert into mycursor values (2004,2551)
>insert into mycursor values (2005,2321)
>alter table mycursor add column growth i
>SELECT MyCursor
>m.lnOldYear = Saled
>SCAN
>    REPLACE growth WITH Saled/m.lnOldYear * 100
>    m.lnOldYear = Saled
>ENDSCAN
create cursor mycursor (year i,saled i, growth I)
insert into mycursor values (1999,1842,0)
insert into mycursor values (2000,1914,0)
insert into mycursor values (2001,1781,0)
insert into mycursor values (2002,1987,0)
insert into mycursor values (2003,2151,0)
insert into mycursor values (2004,2551,0)
insert into mycursor values (2005,2321,0)
SELECT MyCursor
GO TOP    && Important
m.lnOldYear = Saled
SCAN
    REPLACE growth WITH ((Saled- m.lnOldYear)/m.lnOldYear * 100)
    m.lnOldYear = Saled
ENDSCAN
BROWSE NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform