简体   繁体   中英

Multiple inner Joins with tables

I have tried following SQL query,

Select * from Shippers 
Inner Join Orders
ON Shippers.ShipperID =  Orders.ShipperID
Inner join OrderDetails
ON Orders.OrderID = OrderDetails.OrderID

but I'm getting following error :

"Syntax error (missing operator) in query expression 'Shippers.ShipperID=Orders.ShipperID Inner join OrderDetails ON Orders.OrderID=OrderDetails.OrderID'."

Could anyone help me to solve this issue?

Have you tried putting the ON condition inside parentheses?

Is it possible the issue is due to having the same column name from multiple tables? Try just selecting individual columns, instead of * eg

Select Shippers.ShipperID
from Shippers
Inner Join Orders
On (Shippers.ShipperID = Orders.ShipperID)

Have you tried removing one of the tables to see if the error only come up when you add the second table in? In other words does the following query work?

Select * from Shippers 
Inner Join Orders
ON (Shippers.ShipperID = Orders.ShipperID)

Is it possible you have some unprintable ascii characters hiding in there somewhere? What editor are you using? what environment?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM