标签:
这有两个语句,可是这两个语句的结果相同,但其他方面有什么区别呢?
1.select count(ts.tid),ts.tid from t_s ts ,
(select tid from teacher where age<45 group by tid) t
where ts.tid=t.tid
and
ts.sid in (select sid from student where age>12 group by sid)
group by ts.tid;
2.
select teacher.tid,total from teacher ,
(select t_s.tid,count(*) total from student,t_s where student.sid=t_s.sid and student.age>12 group by t_s.tid) as tea_stu2
where
teacher.tid=tea_stu2.tid
and teacher.age<45;
标签:
原文地址:http://www.cnblogs.com/Devilwx/p/4629990.html