Mysql
 sql >> Database >  >> RDS >> Mysql

Query SQL dal passaggio da SubChild a Child a Parent Table

Penso che l'unica cosa che OP sbaglia sia join la chiave sbagliata.

comunque prova prima questo.

SELECT t.id, t.feedback, t1.note as note, p1.name as parent1, p2.name as parent2, 
p3.name as parent3
FROM tblChildOfChild t 
LEFT JOIN tblChild t1 ON t.tblChild_key = t1.id
LEFT JOIN tblParent1 p1 ON t1.tblParent1_key = p1.id
LEFT JOIN tblParent2 p2 ON t1.tblParent2_key = p2.id
LEFT JOIN tblParent3 p3 ON t1.tblParent3_key = p3.id
WHERE t.id = 1