Shuold我使用INNER JOIN條件作爲WHERE條件? 考慮這兩個示例查詢來解釋這個問題:SQL:Shuold我使用INNER JOIN條件作爲WHERE條件?
SELECT t1.*, t2.*
FROM table1 AS t1
INNER JOIN table2 AS t2
ON t1.id = t2.foreign_key
WHERE t1.year < 2014
,這沒有WHERE
條款
SELECT t1.*, t2.*
FROM table1 AS t1
INNER JOIN table2 AS t2
ON t1.id = t2.foreign_key
AND t1.year < 2014
由於聯接類型INNER,這兩個查詢將導致典型的結果集。
哪種性能更好?
謝謝@Sergio的整潔編輯..不知道如何 – rahmanisback
[INNER JOIN ON vs WHERE子句]的可能重複(http://stackoverflow.com/questions/1018822/inner-join-on-vs- where-clause) – rahmanisback