Let say I have a sqlite table like this: S_id |ca1|ca2|exam 1 | 08 | 12 | 35 1 | 02 | 14 | 32 1 | 08 | 12 | 20 2 | 03 | 11 | 55 2 | 09 | 18 | 45 2 | 10 | 12 | 35 3 | 07 | 12 | 35 3 | 04 | 14 | 37 3 | 09 | 15 | 32 4 | 03 | 11 | 55 4 | 09 | 18 | 45 4 | 10 | 12 | 35 5 | 10 | 12 | 35 5 | 07 | 12 | 35 5 | 09 | 18 | 45 I want to select S_id, total and assign a rank on each student based on sum(ca1+ca2+exam) like the following: S_id|total|rank 1 |158 | 5 2 |198 | 1 3 |165 | 4 4 |198 | 1 5 |183 | 3 If there are the same total, like S_id 2 and S_id 4 with rank 1, I want the rank to be jumped to 3.
Thanks for helping
Aucun commentaire:
Enregistrer un commentaire