Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cool_moon
Starting Member
26 Posts |
Posted - 2003-02-16 : 16:43:55
|
hi there,i request you for a SQL of the following case...i want to assign RANK of the student automatically by comparing it with the Marks_Obtain he/she got in the examination.....for e.g there are 5 student in a class _____________________________________________________________________Sr# Student_Name Total_Marks Marks_Obtain RANK(in class)==== ============ =========== ============ ====1) Tori 500 380 42) Nabil 500 460 23) Eve 500 427 34) Jeffery 500 300 55) RobVolk 500 490 1_____________________________________________________________________So in the above case when we assign the Marks_Obtain then the RANK should be calculated automatically,so that the person who have god the maximun Marks_Obtain will be RANK as 1 and so on.So,can you please help me in solving this query.I'll be Greatfull.take care.God Bless You All. |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-02-16 : 16:54:28
|
Well, I'm a little upset because if Jeffery is me, then I have the lowest score ... and RobVolk the highest? no way !! Here's one MS Access way to do this:SELECT M1.[Sr#], M1.Student_Name, M1.Total_Marks, M1.Marks_Obtain, SUM(1) as RankFROM Marks M1, Marks M2WHERE M1.Marks_Obtain <= M2.Marks_ObtainGROUP BY M1.[Sr#], M1.Student_Name, M1.Total_Marks, M1.Marks_ObtainDo a query of this query to order the results by the rank.- JeffEdited by - jsmith8858 on 02/16/2003 16:55:33 |
 |
|
cool_moon
Starting Member
26 Posts |
Posted - 2003-02-17 : 12:58:51
|
Thanx Jeff.......the query you have send is working just fine and BTW .......from now on you will be listed as number 1 in my list... ;) ,take care and God Bless You All. |
 |
|
|
|
|
|
|