本文介绍了为什么我收到“无法绑定多部分标识符"?错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用 SSRS 报告,但我很难理解为什么会出现以下错误:

I recently started using SSRS reports and I am struggling to understand why I am getting the following error:

"The multi-part identifier 'ST.ProvinceID' could not be bound".

我明白错误意味着什么,但我不明白为什么它在这种情况下不起作用.我在我的生活中构建了很多 SQL 语句,但由于某种原因(我仍然需要弄清楚),SSRS SQL 报告并不总是像普通 SQL 查询那样工作.

I understand what the error means, but I don't understand why it's not working in this instance. I have build quite a few SQL statements in my life, but for some reason, (of which I still need to figure out), SSRS SQL reports does not always work the same way a normal SQL query would.

这是我的 SSRS 报告的执行代码:

Here is my execution code for the SSRS report:

SELECT DISTINCT [P].[Title], ST.Branch_CourtName, COUNT(DISTINCT UI.ID) AS NumUsers
FROM ITS___Structural_Location_Details ST, [User_Information_Maintenance] [UI]
JOIN [Province] [P]
ON [P].[ID] = ST.ProvinceID
WHERE ST.ProvinceID = UI.Province
GROUP BY ST.Branch_CourtName

我已经仔细检查了表名和列名的所有拼写.如果您删除 JOIN 它可以工作,但我不明白为什么它在这种情况下不起作用.

I have double checked all the spelling for my table and column names. If you remove the JOIN it works, but I cannot see why it would not work in this instance.

这是所有 3 个表的快速结构.

This is a quick structure of all 3 tables.

Province:  | ITS___Structural_Location_Details:   | User_Information_Maintenance
ID         | ID                                   | ID
Title      | ProvinceID                           | Province

对此的任何帮助将不胜感激.

Any help on this would be appreciated.

谢谢:)

推荐答案

您应该在连接语句中单独指定表.如果我正确理解您的查询,那么您应该能够 INNER JOIN 您的 User_Information_Maintenance 表并删除 WHERE 子句..

You should specify the tables separately in the join statements. If I understand your query correctly then you should be able to INNER JOIN your User_Information_Maintenance table and remove the WHERE clause..

SELECT DISTINCT [P].[Title]
              , ST.Branch_CourtName
              , COUNT(DISTINCT UI.ID) AS NumUsers
FROM ITS___Structural_Location_Details ST
INNER JOIN [Province] [P]
   ON [P].[ID] = ST.ProvinceID
INNER JOIN [User_Information_Maintenance] [UI]
   ON UI.Province = P.ProvinceId
GROUP BY ST.Branch_CourtName

这篇关于为什么我收到“无法绑定多部分标识符"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-10 23:47