简体   繁体   English

带表的多个内部联接

[英]Multiple inner Joins with tables

I have tried following SQL query, 我尝试了以下SQL查询,

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'." “查询表达式'Shippers.ShipperID = Orders.ShipperID的内部连接OrderDetails ON Orders.OrderID = OrderDetails.OrderID中的语法错误(缺少运算符)。”

Could anyone help me to solve this issue? 谁能帮我解决这个问题?

Have you tried putting the ON condition inside parentheses? 您是否尝试过将ON条件放在括号内?

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? 可能您的某处藏有一些无法打印的ASCII字符吗? What editor are you using? 您正在使用什么编辑器? what environment? 什么环境

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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