一条多对多关系表的Sql查询语句

2024-12-18 17:55:33
推荐回答(1个)
回答1:

--楼主这样写就挺好的了 可以有几种写法
--我这样写比你那样的性能要好点
select StudentID, CourseID
from student_course a where exists(select 1 from student_course b where a.CourseID=b.CourseID and a.StudentID=b.StudentID
group by CourseID
having COUNT(1)>30)