sql - Adding more joins to a select -
i having trouble trying add 2 more joins select. bellow works me:
from table1 inner join table2 b on a.id = b.id left join table3 c on a.requested_by = c.user_name left join table3 d on a.coordinator = d.user_name inner join table4 e on a.id = e.parent_id inner join table5 f on e.id = f.id
but need more information, tried (added last 2 rows):
from table1 inner join table2 b on a.id = b.id left join table3 c on a.requested_by = c.user_name left join table3 d on a.coordinator = d.user_name inner join table4 e on a.id = e.parent_id inner join table5 f on e.id = f.id inner join table6 g on a.id = b.id left join table3 h on g.coordinator = h.user_name
and isn't working should.
question: how can add last 2 joins make select works? thanks.
you're not joining table6 (g) anywhere. think join:
inner join table6 g on a.id = b.id
should instead:
inner join table6 g on a.id = g.id
and side note, hope you're using table aliases more meaningful a, b, c, etc. in real code. ;-)
Comments
Post a Comment