I have a little problem, I'm stuck. I have two tables. The first contains all id, the second contains some, but not all of tableA, the value and the corresponding identifier. Since I thought I understood, the left join on id should give me all id in the first table, and null for the second if id does not exist in tableB. But I keep getting the id number that exists in both tables. I misunderstood the concept?
My statement so far:
SELECT tableA.id, tableB.desiredValue
FROM tableA
LEFT JOIN tableB ON tableA.id=tableB.item_id
WHERE tableB.element_id = 'something'
OR tableB.element_id IS NULL;
Any pointers?
Thanx, Best Regards, Marcus
source
share