5

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.

Hunain Hafeez
  • 71
  • 1
  • 1
  • 9

1 Answers1

5

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 ...
bluish
  • 26,356
  • 27
  • 122
  • 180
dani herrera
  • 48,760
  • 8
  • 117
  • 177
  • SELECT tblApplication.advid, tblApplication.scrdoc, tblApplication.position, tblJobAdv.advtitle, tblJobBudget.title, tblPersonalInfo.country, tblPersonalInfo.city,tblPersonalInfo.companyname FROM tblApplication INNER JOIN tblJobAdv ON tblApplication.advid = tblJobAdv.advid INNER JOIN tblJobBudget ON tblJobAdv.jbid = tblJobBudget.jbid inner join tblPersonalInfo On tblPersonalInfo.userid = tblJobBudget.lastmodifiedby where tblApplication.position = 'selected' – Hunain Hafeez Dec 29 '12 at 15:36