I am trying to join two tables together where the second table may not have a related record. In that case, I want the data from the first table to still display. I am able to do this with a LEFT JOIN but the problem I am running into is that I have a reference to the second table in the WHERE statement.
SELECT a.field1, a.field2, b.field2 from a
LEFT JOIN b ON a.id = b.id
WHERE a.field1 = "value" AND b.field1 = "value"
It seems that since I reference table b in the WHERE statement, I am only getting records where there is a related record in table b. Is there a way to still include table b in the WHERE statement and still return records from table a even if there is not a related record in table b?
Thanks!