The multi-part identifier ... could not be bound

  • Hi,

    I've been receiving this error message when I try to run the following query. Having looked around it seems fairly common but none of the other forums have been able to help me to resolve it.

    I have these tables:

    dbo.tblProfiles

    ProfileID

    ProjectID

    RecruiterID

    ScreenerID

    dbo.tblProjects

    ProjectID

    Title

    dbo.tblResources

    ResourceID

    CompanyName

    dbo.tblRecruiters

    RecruiterID

    ResourceID

    I want to find which Recruiter(s) (CompanyName) are associated with which Projects (Title) where ScreenerID is not equal to something. Using the following query:

    Select Title, CompanyName

    from dbo.tblProjects, dbo.tblResources

    Join dbo.tblProfiles

    on dbo.tblProjects.ProjectID = dbo.tblProfiles.ProjectID

    Join dbo.tblRecruiters

    on dbo.tblResources.ResourceID = dbo.tblRecruiters.ResourceID

    where ScreenerID <> 0

    go

    I get the following error:

    Msg 4104, Level 16, State 1, Line 4

    The multi-part identifier "dbo.tblProjects.ProjectID" could not be bound.

    Thanks

  • Gareth, you need to spend more time working on your homework yourself before posting in the forums, otherwise you will get nowhere. This problem may look confusing but it's really a trivial query. Try this:

    SELECT rs.CompanyName, pj.Title

    FROM dbo.tblRecruiters r

    INNER JOIN dbo.tblResources rs ON rs.ResourceID = r.ResourceID

    INNER JOIN dbo.tblProfiles pf ON pf.RecruiterID = r.RecruiterID

    INNER JOIN dbo.tblProjects pj ON pj.ProjectID = pf.ProjectID

    WHERE NOT pf.ScreenerID = 'something'

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply