(1) select * from t1 a (2) left join(select * from t2 where ……)b (3) on a.f1=b.f1 (4) where a.f2 …… ------------------------------------------------- 问题: 执行顺序是 2、3、4、1 还是 4、1、2、3 还是……
[Quote=引用 16 楼 csdyyr 的回复:]
--查询的逻辑执行过程,来自技术内幕
(8) SELECT (9) DISTINCT (11) <TOP_specification> <select_list>
(1) FROM <left_table>
(3) <join_type> JOIN <right_table>
(2) ON <join_condition>
(4) WHERE <where_condition>
(5) GROUP BY <group_by_list>
(6) WITH {CUBE | ROLLUP}
(7) HAVING <having_condition>
(10) ORDER BY <order_by_list>
select * from stu where classId in (select classId from shool where schoolname = '一中')
查询的顺序是 A.select * from stu
B. select classId from shool where shoolname = '一中'
再从A中选出 stu 是 "一中"的学生信息