SQL未解析的对象到对象。对象不存在或引用不明确

时间:2016-03-20 11:58:05

标签: sql inner-join

我正在尝试使用INNER JOIN创建一个视图:

CREATE VIEW [dbo].[MatchingTeamNames]
AS SELECT  [XMLSoccer-Team].[ID] AS SoccerID, [XMLSoccer-Team].[Name] AS SoccerName,
            [Smarkets-Team].[ID] AS SmarketsID, [Smarkets-Team].[Name]
FROM [XMLSoccer-Team], [MatchingTeamIDs], [Smarkets-Team]
INNER JOIN [MatchingTeamIDs] ON [MatchingTeamIDs].[XMLSoccerID] = [XMLSoccer-Team].[ID]

我收到INNER JOIN最后一部分的错误:[XMLSoccer-Team].[ID]

  

SQL未解析对象的对象。对象不存在或引用不明确

我出错的任何想法?

感谢。

1 个答案:

答案 0 :(得分:1)

这是什么?隐式和显式连接语法在一起? DON' T 曾经这样做过!

使用显式连接语法尝试此查询:

CREATE VIEW [dbo].[MatchingTeamNames]
AS SELECT  [XMLSoccer-Team].[ID] AS SoccerID, [XMLSoccer-Team].[Name] AS SoccerName,
            [Smarkets-Team].[ID] AS SmarketsID, [Smarkets-Team].[Name]
FROM [XMLSoccer-Team]
INNER JOIN [MatchingTeamIDs]
 ON [MatchingTeamIDs].[XMLSoccerID] = [XMLSoccer-Team].[ID]
INNER JOIN  [Smarkets-Team]
 ON (The Relations between this tables Smarkets-Team and the table its connected to)