Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rank code
Message
De
25/09/2008 09:40:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2008 Server
Database:
Visual FoxPro
Divers
Thread ID:
01350486
Message ID:
01350526
Vues:
22
>This doesn't account for absolute ties (same scores in all subjects).
>
The only way to do that is to work with a group by

This is what I had - but works only on ties with the total score -
create cursor test ;
	(	Student	I, ;
		English	I, ;
		Maths	I, ;
		Science	I, ;
		Total	I, ;
		Rank	I ;
	)
	
	insert into test values(5, 0,0,0, 489, 0)
	insert into test values(4, 0,0,0, 492, 0)
	insert into test values(3, 0,0,0, 391, 0)
	insert into test values(2, 0,0,0, 391, 0)
	insert into test values(1, 0,0,0, 389, 0)
	
	select	cast(0 as I)	as RankTmp,;
			Total ;
		from test ;
		into cursor tmp ReadWrite ;
		group by 1, 2 ;
		order by 1 desc, 2 desc	
	
	repl Ranktmp with recno() all in tmp
	
	update test ;
		set Rank = tmp.RankTmp ;
			from tmp ;
			where (test.Total == tmp.Total )
	
	selec * from Test order by Rank
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform