1
從我所瞭解到的關於左外連接的所有內容中,您希望爲空的表應位於等號的右側。如果是這樣的話,爲什麼這兩個查詢返回相同的結果:左外連接表排序
SELECT *
FROM employees e
LEFT JOIN cars c ON c.employeeID=e.id AND c.name='Honda City'
WHERE c.id IS NULL
ORDER BY e.id ASC;
SELECT *
FROM employees e
LEFT JOIN cars c ON e.id=c.employeeID AND c.name='Honda City'
WHERE c.id IS NULL
ORDER BY e.id ASC;
演示:http://sqlfiddle.com/#!15/46d00/2
這兩個查詢是相同的。左側和右側來自哪個_table_首先。檢查此[小提琴](http://sqlfiddle.com/#!15/46d00/4) – paqogomez