我正在尝试联接2个表并收到此错误。
关于模式:PK是a.app_guid,s.space_guid,o.org_guid。
无法绑定多部分标识符“ apps.space_guid”
SELECT
a.app_guid,
a.name,
a.state,
a.created_at,
a.updated_at,
deleted_at,
a.space_guid,
a.foundation,
a.timestamp,
s.space_guid,
s.name,
s.created_at,
s.updated_at,
s.timestamp,
s.foundation,
s.org_guid,
o.org_guid,
o.created_at,
o.updated_at,
o.name,
o.timestamp,
o.foundation
FROM
apps a, spaces s, organizations o
INNER JOIN
[spaces] ON [apps].[space_guid] = [spaces].[space_guid]
INNER JOIN
[organizations] ON [spaces].[org_guid] = [organizations].[org_guid]
预期结果将包括一个表格,其中所有表格均根据space_guid
和org_guid
答案 0 :(得分:1)
我认为您不想交叉连接和内部连接表格。
您只是弄乱了语法。
使用以下正确的联接语法:
SELECT
a.app_guid,
a.name,
a.state,
a.created_at,
a.updated_at,
deleted_at,
a.space_guid,
a.foundation,
a.timestamp,
s.space_guid,
s.name,
s.created_at,
s.updated_at,
s.timestamp,
s.foundation,
s.org_guid,
o.org_guid,
o.created_at,
o.updated_at,
o.name,
o.timestamp,
o.foundation
FROM
apps a
INNER JOIN
spaces s ON a.space_guid = s.space_guid
INNER JOIN
organizations o ON s.org_guid = o.org_guid