select s.sno,s.sname,
sum(case when t.cno in('CS112', 'CS114') then 1 else 0 end)
from student s inner join take t on t.sno = s.sno
group by s.sno,s.sname
having sum(case when t.cno in('CS112', 'CS114') then 1 else 0 end) = 2
and count(*) = 2
No comments:
Post a Comment