I'm trying to find the best 5 students from 2016 and 2017. My query right now looks like this:
SELECT S.vorname,
S.nachname,
MAX(I.abgeschlossen) AS Abschlussjahr,
A.note
FROM student AS S
INNER JOIN inskription AS I ON S.matnr= I.student
INNER JOIN absolvierung AS A ON S.matnr = A.student
WHERE A.note = 1
AND YEAR(I.abgeschlossen) IN ('2016', '2017')
GROUP BY S.vorname, S.nachname, A.note
ORDER BY Abschlussjahr DESC
and the output looks like this:
What is a possible way to have the top 5 from 2016 and 2017 in the same column?