我需要知道它是性能的最佳选择。例如,我在查询中有多个连接:
选项1:WHERE子句
SELECT *
FROM TableA A
INNER JOIN TableB B ON B.IdA = A.Id
INNER JOIN TableC C ON C.IdB = B.Id
INNER JOIN TableD D ON D.IdC = C.Id
INNER JOIN TableE E ON E.IdD = D.Id
WHERE A.Colum1 = 'SOME'
AND B.Colum2 = 1
AND C.Colum3 IS NOT NULL
选项2:加入条件
SELECT *
FROM TableA A
INNER JOIN TableB B ON B.IdA = A.Id AND A.Colum1 = 'SOME' AND B.Colum2 = 1
INNER JOIN TableC C ON C.IdB = B.Id AND C.Colum3 IS NOT NULL
INNER JOIN TableD D ON D.IdC = C.Id
INNER JOIN TableE E ON E.IdD = D.Id
抱歉我的英文。此致