Spookbuster
SELECT ozndvorana, student.jmbag, imestudent, prezimestudent, SUM(datumvrijemekraj - datumvrijemepoc) AS suma
FROM dvorana NATURAL JOIN evidencijaboravka NATURAL JOIN student
WHERE EXTRACT(MONTH FROM datumvrijemepoc) = 2
AND EXTRACT(MONTH FROM datumvrijemekraj) = 2
AND datumvrijemepoc IS NOT NULL
AND datumvrijemekraj IS NOT NULL
GROUP BY ozndvorana, student.jmbag, imestudent, prezimestudent
HAVING AVG(datumvrijemekraj - datumvrijemepoc) > '2 HOURS 55 MINUTES'::interval;
Probaj ovo?