0

I have 4 tables I need information from. 3 tables I can use implicit inner joins and one needs to be a left join. When I try to add the left join I get the error:

Msg 4104, Level 16, State 1.
The multi-part identifier "dbo.jobConsultants.JobId" could not be bound. (Line 3)'

I think its because im trying to use 2 type of joins. Ive tried adding the other 3 tables through inner joins but It doesnt seem to work

My query:

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
Yogesh Sharma
  • 49,870
  • 5
  • 26
  • 52
Will
  • 348
  • 1
  • 2
  • 12

0 Answers0