I have this query:
SELECT table1.foo, table2.bar, table3.abc, table4.xyz FROM table1 table1, table2 table2, table3 table3, table4 table4 WHERE table1.id = table2.id AND table1.id2 = table3.id2 AND table1.id3 = table4.id3 AND (table1.foo BETWEEN 10 AND 30)
I'd like to get additional rows in results, with data in table1 that doesn't have matching records in table2 and table3, but still only those that match data in table4.
How can I write this?
I think I need two left joins and keep the third normal join.
TABLE1: id (references TABLE2), id2 (references TABLE3), id3 (references TABLE4), foo
TABLE2 id, bar
TABLE3 id, abc
TABLE4 id, xyz