select * from 学生表 ,
INNER JOIN (SELECT 学号 FROM (SELECT 学号, COUNT(*) AS 选课数 FROM 选课表 GROUP BY 学号) AS temp4 WHERE (选课数= (SELECT 选课数 FROM (SELECT 学号, COUNT(*) AS 选课数 FROM SC GROUP BY 学号) AS temp5 WHERE (学号 = '001102')))) AS temp6
ON 学生表.学号 = temp6.学号
where 学号 in
(select distinct 学号 from 选课表 t1
where not exists
(select * from 选课表 t2
where 学号='001102' and not exists
(select * from 选课表 t3
where t3.学号=t1.学号 and t3.课程号=t2.课程号)))
mssql2005下正常