Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get percentage(%) with sql command
Message
From
17/09/2005 00:24:37
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01049464
Message ID:
01050550
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Dear

PUBLIC NAME1,OBMARKS,TOTMARKS
STORE SPACE(30) TO NAME1
STORE 0 TO OBMARKS,TOTMARKS

CREATE TABLE Master1 (NAME1 C(10), OBMARKS N(4),TOTMARKS N(4))
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("A",400,850)
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("B",685,850)
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("C",700,850)
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("D",200,850)
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("E",279,850)
INSERT INTO Master1 (NAME1,OBMARKS,TOTMARKS) VALUES ("F",510,850)

Test = "csr" + SYS(2015) && gives you unique cursor name everytime
SELECT *,;
TRANSFORM((OBMARKS/TOTMARKS)*100,"##.##") AS PERCENTAGE;
FROM Master1;
ORDER BY PERCENTAGE DESCENDING;
INTO CURSOR XYZ

SELECT XYZ
BROW

I hope this will help
Previous
Reply
Map
View

Click here to load this message in the networking platform