我是一位具有SQL經驗的分析師,但我還沒有加入超過2個表。我試圖加入這3個表格,但我無法將表格與成功結合在一起。我究竟做錯了什麼?SQL三連接:無法三連接
Use Db3
Select Persons.DateOfBirth
, Persons.DisabilityCode
, Persons.Ethnicity
, Persons.Gender
, Persons.Country
, Persons.MaritalStatus
, Persons.Suffix
, Persons.LastName
, Persons.FirstName
, Persons.MiddleName
, Persons.CommonOrPreferredName
, Persons.Credentials
, Persons.IsActive
, Persons.MilitaryStatus
, Jobs.Id
, Jobs.AdjustedDateOfHire
, Jobs.DateOfHire
, Jobs.CompanyOwnershipStatus
, Jobs.LeaveDate
, Jobs.TerminationDate
, OrganizationalAssociations.Id
, OrganizationalAssociations.EmployeeNumber
, OrganizationalAssociations.SourceSystemEmployeeId
, OrganizationalAssociations.EmploymentType
From Persons Person
JOIN Persons ON Persons.Id = Jobs.Id
JOIN Jobs ON Jobs.Id = Persons.Id
JOIN OrganizationalAssociations ON OrganizationalAssociations.Id = Persons.Id
錯誤消息:Jobs.Id無法綁定
你可以發表三張表的表結構嗎?數據庫Db3中的Jobs表上是否有Id列? – TTeeple
您正在使用Persons表兩次加入四張表 – Sherlock
您真的需要在此查詢中的第一個JOIN(Persons to self)嗎? – C8H10N4O2