-2

在我的 SQL 查询中,我收到错误:

无法绑定多部分标识符“a.Position_ID”。

我不确定是什么原因造成的。任何人都可以帮忙吗?

谢谢。

select distinct 
   a.HireLastName, a.HireFirstName, a.HireID, a.Position_ID, a.BarNumber, 
   a.Archived, a.DateArchived, b.Position_Name
from NewHire a, WorkPeriod c
join Position b on a.Position_ID = b.Position_ID
where 
    a.Archived = 0 
    and a.HireID = c.HireID 
    and c.InquiryID is not null 
order by 
    a.HireID DESC, a.HireLastName, a.HireFirstName
4

1 回答 1

1

您的代码未加入表 c,我认为这可能会导致您的别名 a 出现问题。你可以试试这个:

select distinct 
    a.HireLastName, 
    a.HireFirstName, 
    a.HireID, 
    a.Position_ID, 
    a.BarNumber, 
    a.Archived, 
    a.DateArchived, 
    b.Position_Name
from NewHire a 
join Position b on a.Position_ID = b.Position_ID
join WorkPeriod c on a.hireID = c.HireID
where a.Archived = 0 and c.InquiryID is not null 
order by a.HireID DESC, a.HireLastName, a.HireFirstName
于 2013-05-13T20:14:42.293 回答