okay, here's how it works
with two tables in a LEFT OUTER JOIN, you should get unmatched rows from the left table, where there will be a row in the result with data in the columns that come from the left table, and NULLs in all the columns that come from the right table
conditions for the left table belong in the WHERE clause, while conditions for the right table belong in the ON clause of the join
to demonstrate the difference, run these two versions of the query --
Code:
FROM fe_cars
LEFT OUTER
JOIN fe_tanks
ON fe_tanks.cid = fe_cars.cid
AND fe_tanks.deleted = 0
WHERE fe_cars.cid = $cid
Code:
FROM fe_cars
LEFT OUTER
JOIN fe_tanks
ON fe_tanks.cid = fe_cars.cid
WHERE fe_cars.cid = $cid
AND fe_tanks.deleted = 0
see if you can spot the difference in the results -- with the first query, there will be unmatched rows, but with the second, it will be as if it were an inner join, as no unmatched rows will be returned
Bookmarks