I am trying to compose a SELECT statement for MySQL which select from table A what does not exist in table B. Most of examples use only one field as key. In my case, I have 3 fields.
TableA => a.fieldA, a.fieldB, a.fieldC
1,1,1
1,2,1
1,3,1
1,4,1
1,5,1
TableB => b.fieldA, b.fieldB, b.fieldC
1,1,1
1,3,1
1,4,1
So I only want the fields from TableA that does not exist in TableB
Result
1,2,1
1,5,1
I tried LEFT JOIN, but have no luck
SELECT a.fieldA, a.fieldB, a.fieldC
FROM TableA a
LEFT JOIN TableB b ON (
a.fieldA = b.fieldA
AND a.fieldB = b.fieldB
AND a.fieldC = b.fieldC)
WHERE a.fieldA = 1
AND a.fieldC = 1
I also tried NOT IN, but didn't know how to do that with 3 fields.
I know this must be simple, but I am blind. bad day :(