mySQL你如何做一个连接链?

时间:2015-11-20 08:04:23

标签: mysql sql database join

enter image description here

嗨!我试图弄清楚如何在同一行代码中的多个步骤中进行连接。这是我到目前为止所得到的,但我收到错误1064。

select * from jbcity
join jbsupplier on jbsupplier.city = jbcity.name where jbcity.state = "Mass"
join jbsupply on jbsupply.supplier = jbsupplier.id
join jbparts  on jbparts.id = jbsupply.part;

1 个答案:

答案 0 :(得分:2)

试试这个:

select * from jbcity
join jbsupplier on jbsupplier.city = jbcity.name 
join jbsupply on jbsupply.supplier = jbsupplier.id
join jbparts  on jbparts.id = jbsupply.part where jbcity.state = 'Mass';