I’m still struggling difficulties with even simple JOIN queries. From my last question, Simple but nested SELECT query, I learned many things, but still couldn’t accomplish my JOIN queries. 🙁
I have this query from the last question, and it’s working:
SELECT c.value, d.value
FROM a
LEFT JOIN b
ON a.id = b.idy
LEFT JOIN c
ON b.idx = c.id
LEFT JOIN d
ON b.idx = d.id
WHERE a.name = "test"
Now, I want to add another conditions to the query to look on tables e,f,g and if any of a.id, b.idx, c.id, d.id DOESN’T exists on the tables e,f,g, then return the results. For example if c.id exists on e.id then it should eliminates the row from table c. If a.id exists on g.id, it should not continue because if you took off the a.id from the query, the other parts should not return anything.
I’ve made a sample database structure which you can see the sql code here: Sample.sql
You mean something like this?