Если вам нужен максимальный код на единицу, используйте агрегацию:
SELECT unitcode, MAX(maxcount)
FROM (SELECT COUNT(studid) as maxcount, semester, e.unitcode, u.unitname
FROM uni.enrolment e JOIN
uni.unit u
ON e.unitcode = u.unitcode
WHERE ofyear >= DATE '2013-01-01' AND ofyear < DATE '2014-01-01'
GROUP BY semester, e.unitcode, u.unitname
) eu
GROUP BY unitcode;
На основе вашего комментария вы хотите:
SELECT COUNT(studid) as maxcount, semester, e.unitcode, u.unitname
FROM uni.enrolment e JOIN
uni.unit u
ON e.unitcode = u.unitcode
WHERE ofyear >= DATE '2013-01-01' AND ofyear < DATE '2014-01-01'
GROUP BY semester, e.unitcode, u.unitname
ORDER BY maxcount DESC
LIMIT 1