Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Upgrade records with students numbers
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01473394
Message ID:
01473398
Vues:
50
This message has been marked as the solution to the initial question of the thread.
>I have fields :
>
>sid      total    student_number  rank
>
>1         100            99               1
>2         100            90               2
>3          100           90               2
>4           100           70              3
>....
>I want to update student ranks in my table
What is your database? In SQL Server you can use DENSE_RANK() function. In VFP you need two steps:
create cursor Ranks (Rank I autoinc, Student_Number I)

insert into Ranks (Student_Number) select Distinct Student_Number from StudentScores ORDER BY Student_Number DESC

Update S set Rank = Ranks.Rank from StudentScores S inner join Ranks on S.Student_Number = Ranks.Student_Number
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform