I'm trying to use a left join to list all the records in multiple tables, but it is repeating. (It goes back and lists the dealer table again)
I have 3 tables:
dealers
dealerId, dealerName
address2Rel
address2RelId, reldealerId, reladdress2Id
addresses2
addresses2Id, address2
I'm using the statement
SELECT dealerName, address2 FROM dealers, address2Rel LEFT JOIN addresses2 ON addresses2.addresses2Id = reladdress2Id AND address2Rel.reldealerId = dealers.dealerId WHERE address2Rel.reldealerId = dealers.dealerId
I need to list all the dealerName(s), even if this dealer does not have an address2. Whenever I put a where clause, I only get the dealers that have an address2.
How can I get it to just go through once?
thanks