sqlsql-server-2008inner-joinmultiple-select-query

The multi-part identifier could not be bound


trying this

select tblPersonalInfo.companyname, tblJobBudget.title,tblJobBudget.lastmodifiedby,
tblJobAdv.advtitle, tblJobAdv.userId,       
tblApplication.advid, tblApplication.position
from tblJobAdv 
inner join tblApplication
ON tblJobAdv.advid = tblApplication.advid
inner join tblPersonalInfo
On tblJobBudget.lastmodifiedby = tblPersonalInfo.userid

gives error

Msg 4104, Level 16, State 1, Line 8
The multi-part identifier "tblJobBudget.lastmodifiedby" could not be bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "tblJobBudget.title" could not be bound.
Msg 4104, Level 16, State 1, Line 2

The multi-part identifier "tblJobBudget.lastmodifiedby" could not be bound.


Solution

  • This is because there aren't any table or table alias with tblJobBudget identifier.

    Your tables are:

    But not:

    If you need columns from table tblJobBudget you should include tblJobBudget in tables with a join clause:

    from       tblJobAdv 
    inner join tblApplication
       ON tblJobAdv.advid = tblApplication.advid
    inner join tblJobBudget                              <--here
       ON ...
    inner join tblPersonalInfo
       ON ...