mysql - SQL Query enclosed join -
mysql - SQL Query enclosed join -
i have next tables:
animal ------------------------------- id name color carid shipid ship ----------------------------------- id length depth auto ------------------------------------ id create model planeid plane ------------------------------ id country wingspan
all keys expected (planeid fkey plane.id)
i looking create next query homecoming animals where:
animal.shipid=47 animal.car.plane.country = republic of kenya or islamic republic of iran or russian federation
so far have like:
select animal.* animal left bring together ( select * auto bring together plane on car.planeid = plane.id) on animal.carid = car.id animal.shipid = 47
this not work , have tried several permutations of this, help appreciated. thanks!
assuming want shipid = 47 or country in ('kenya ','iran ','russia')
select animal.* animal left outer bring together ship on animal.shipid = ship.id left outer bring together auto on animal.carid = car.id left outer bring together plane on car.planeid = plane.id animal.shipid = 47 or plane.country in ('kenya ','iran ','russia')
mysql sql join
Comments
Post a Comment