Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get rank value without rank field
Message
From
15/07/2011 19:44:38
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
15/07/2011 19:02:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Miscellaneous
Thread ID:
01518322
Message ID:
01518323
Views:
65
>Hi Experts,
>
>Is it possible to obtain one's ranking without the need to maintain a rank field?
>
>For example, if we have a Grades table:
>
>Student GenAve
>Marc 98%
>Steve 89%
>Jeff 90%
>Adrian 92%
>Dennis 80%
>
>I would then like to do a:
>
>
>SELECT Student, GenAve, SomeRankFunction() as Rank FROM Grades ORDER BY Rank
>
>
>I guess the above should be MySQL syntax since my backend is MySQL.

If you're pulling those data into a VFP cursor, the record number can be used as the rank:
SELECT ;
  Student ;
  , GenAve ;
  FROM Grades ;
  ORDER BY GenAve DESC

* then, in your VFP cursor RECNO() gives the rank
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform