我有这个问题:
select orders.*
,customers.name as customername
,customers.city as customercity
,managers.name as managername
,godowns.name as godownname
from orders
inner join customers
inner join managers
inner join godowns on orders.customerid=customers.customerid
and orders.managerid=managers.managerid
and orders.godownid=godowns.godownid
order by orderid desc;
我收到了以下错误:
未知栏' orders.customerid'在' on'
我一直在讨厌这个问题超过一天。它适用于一个系统,而不是另一个系统!
答案 0 :(得分:1)
select orders.*,customers.name as customername,customers.city as customercity,managers.name as managername,godowns.name as godownname
from orders
inner join customers on orders.customerid=customers.customerid
inner join managers on orders.managerid=managers.managerid
inner join godowns on orders.godownid=godowns.godownid
order by orderid desc
每个联接都需要一个on
子句