更新时间:2022-02-21 21:58:34
将用户名条件从WHERE
子句移动到ON
子句.
Move the username condition from the WHERE
clause to the ON
clause.
SELECT *
FROM cars
LEFT JOIN carLog
ON cars.id=carLog.car
AND carLog.username='Juddling'
在JOIN已经完成时,将应用WHERE子句.这意味着,它将丢弃LEFT JOIN添加的NULL行.
The WHERE clause is applied when the JOIN is already completed. This means, it will discard the NULL rows that the LEFT JOIN added.