select S.Sno,S.Sname from
(
select Sno, COUNT(Cno) as num from SC where Cno in (
select Cno from S join SC on S.Sno = SC.Sno and Sname ='张征'
)
group by Sno
) t2
join(select COUNT(Cno) num from S join SC on S.Sno = SC.Sno and Sname ='张征' ) t1 on t2.num = t1.num
join S on S.Sno = t2.Sno
已验证过
你也太会玩了吧,让人横着看啊