在此先感谢您的帮助:
[People]
表有两列:
- 个人ID
- 人名
[Marriages]
表有三列:
- 结婚证
- 个人身份证
- 个人IDb
我想选择以下列:
- 结婚证
- 人名(对于 personIDa)
- PersonName(用于 personIDb)
我想我需要使用SELECT
带有 a 的语句JOIN
,但我不确定如何为每个PersonName
. 这是我到目前为止所拥有的(这不起作用):
SELECT
[Marriages].[MarriageID],
[People].[PersonName] AS aName,
[People].[PersonName] AS bName
FROM
[Marriages]
JOIN
[People] ON [Marriages].[PersonIDa] = [People].[PersonID]
JOIN
[People] ON [Marriages].[PersonIDb] = [People].[PersonID]
再次感谢...