Kali ini kita akan menambahkan RANGKING bersarkan Kelas dan Nilai akhir, Berikut Script Query SQL-nya.
SELECT DISTINCT KELAS, SISWA, RANGKING FROM (SELECT SISWA, KELAS, NILAI_AKHIR, @student:=CASE WHEN @class <> KELAS THEN 1 ELSE @student+1 END AS RANGKING, @class:=KELAS AS CLASS FROM(SELECT @student:= 0) AS s, (SELECT @class:= 0) AS c, (SELECT * FROM Nilai GROUP BY KELAS, SISWA ORDER BY KELAS, SISWA DESC ) AS temp ) AS temp2
Silahkan unduh Source-nya disini
0 comments:
Posting Komentar