INNER JOIN 之前的 WHERE 子句
如果我有
SELECT * FROM Table1 t1
LEFT JOIN Table2 t2 ON t1.id = t2.id
WHERE t1.user='bob';
WHERE
子句是否在两个表 JOINED
之后运行?
Does the WHERE
clause run after the two tables are JOINED
?
如何使它在 JOIN 之前运行?
How do I make it so it runs prior to the JOIN?
推荐答案
将WHERE
改成另一个JOIN
条件
LEFT JOIN Table2 t2 on t1.id = t2.id AND t1.user='bob'
相关文章