学生表 student (id,name)
成绩表 score (id,student_id,subject,grade);
求查询既参加A又参加B考试的学生。
我有一种土办法,但是不知道高不高效,
select * from student where id in (select * from score where subject = "A") and id
in (select * from score where subject = "B");
成绩表 score (id,student_id,subject,grade);
求查询既参加A又参加B考试的学生。
我有一种土办法,但是不知道高不高效,
select * from student where id in (select * from score where subject = "A") and id
in (select * from score where subject = "B");
![](http://imgsrc.baidu.com/forum/pic/item/39a859da81cb39db5d085199d1160924a91830a5.jpg?v=tbs)