我有4个需要查询信息的表。我可以使用3个表使用隐式内部联接,并且其中之一需要是左联接。当我尝试添加左联接时,出现错误:
信息4104,级别16,状态1。
不能绑定多部分标识符“ dbo.jobConsultants.JobId”。 (第3行)'
我认为这是因为我试图使用2种类型的联接。香港专业教育学院试图通过内部联接添加其他3个表,但似乎不起作用
我的查询:
SELECT TOP 10 dbo.jobConsultants.JobId AS 'Job ID', dbo.jobConsultants.UserId AS 'Consultant ID', dbo.Users.userName AS 'Consultant first name', dbo.Users.surname AS 'Consultant surname', dbo.Clients.ClientID AS 'Client ID', dbo.Clients.Company, dbo.Jobs.JobTitle AS 'Job Title', dbo.Jobs.CreatedOn AS 'Date created', COUNT(dbo.ApplicantActions.JobId) AS 'Applicants'
FROM dbo.jobConsultants, dbo.Users, dbo.Clients, dbo.Jobs
LEFT JOIN dbo.ApplicantActions ON dbo.jobConsultants.JobId = dbo.ApplicantActions.JobId
WHERE dbo.jobconsultants.UserId = dbo.Users.UserId AND dbo.Clients.ClientID = dbo.Jobs.ClientId AND dbo.Jobs.JobId = dbo.jobConsultants.JobId
GROUP BY dbo.jobConsultants.JobId, dbo.jobConsultants.UserId, dbo.Users.userName, dbo.Users.surname, dbo.Clients.ClientID, dbo.Clients.Company, dbo.Jobs.JobTitle, dbo.Jobs.CreatedOn, dbo.jobConsultants.JobId
ORDER BY 'Date Created' DESC