I am guessing there is a mistake in the nested query however I cannot seem to find it myself. Here is the query:
Select student.sid, name from student join exam on exam.sid = student.sid where student.sid in (select * from course join exam on cid=courseid group by exam.sid having sum(credits) >= 20)
Thank you in advance!
You can use the group by as follows:
group by
select s.sid, s.name from student s Join exam e on s.sid = e.sid Join course c on c.cid = e.courseid group by s.sid, s.name having sum(c.credits) >= 20
2.1m questions
2.1m answers
60 comments
57.0k users