SQL 无法绑定多部分标识符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14082520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:52:22  来源:igfitidea点击:

The multi-part identifier could not be bound

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

提问by Hunain Hafeez

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.

无法绑定多部分标识符“tblJobBudget.lastmodifiedby”。

采纳答案by dani herrera

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

这是因为没有任何带有tblJobBudget标识符的表或表别名。

Your tables are:

你的表是:

  • tblJobAdv
  • tblApplication
  • tblPersonalInfo
  • tblJobAdv
  • tblApplication
  • tblPersonalInfo

But not:

但不是:

  • tblJobBudget
  • tblJobBudget

If you need columns from table tblJobBudgetyou should include tblJobBudgetin tables with a joinclause:

如果您需要表中的列,tblJobBudget则应包含tblJobBudget在带有join子句的表中:

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