I have a query that goes like this
SELECT s.studentid, firstname,lastname,dp,startyear,sum(credits)
FROM students s, results r, courses c
GROUP BY s.studentid
HAVING (dp, startyear) = (SELECT dp, startyear FROM students WHERE studentid=18);
I need to filter it so that it only returns those that have credits less than student 18. I am stuck now as to how to do that. Any ideas?
Also this one above misses out one record as they have no credits. How could I get it still to display the name etc but the sum to read as 0?
Thanks in advance