Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rank code
Message
 
 
To
25/09/2008 09:40:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2008 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01350486
Message ID:
01350531
Views:
35
Hi Gregory,

The original requirement was to check other subjects, so you need to group by total, by total in English, in math, etc., but the idea seems to work. In other words, you need to relate based on score, not by ID.

>>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
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform