有个场景
[img]http://dl.iteye.com/upload/attachment/0076/9507/5264ec3c-5b6a-34e2-b21d-33653a4dde79.jpg[/img]
需要找出具体有两门特定课程的同学
这里需要用exists来判断
[img]http://dl.iteye.com/upload/attachment/0076/9507/5264ec3c-5b6a-34e2-b21d-33653a4dde79.jpg[/img]
需要找出具体有两门特定课程的同学
这里需要用exists来判断
--找出既是boss 又是basketball
select t.name
from t_student t
where exists (SELECT name FROM t_student where course_name='basketball' and t.name =name)
and exists (SELECT name FROM t_student where course_name='boss' and t.name =name)