The multi-part identifier could not be bound

Hunain Hafeez picture Hunain Hafeez · Dec 29, 2012 · Viewed 49.7k times · Source

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.

Answer

dani herrera picture dani herrera · Dec 29, 2012

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

Your tables are:

  • tblJobAdv
  • tblApplication
  • tblPersonalInfo

But not:

  • tblJobBudget

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 ...