0

我是一个新代码,无法让子查询与主查询数据一起工作。本质上,我想从结果中计算出有多少台 PC 是 HP PC。当我运行它时,出现错误:无法绑定多部分标识符“dbo.softwareapplications.softwareid”。

select distinct appname, version, linkid,
(select count(make) as totalhp from dbo.workstations where make = 'Hewlett-Packard' and linkdid = t1.linkid)as totalhp
from dbo.softwareapplications as t1
join dbo.assignments on dbo.softwareapplications.softwareid = dbo.IQCSassignments.softwareid
join dbo.workstations on dbo.assignments.wsid = dbo.workstations.wsid
group by assetdescription, version, linkid, totalhp

任何帮助,将不胜感激。

4

2 回答 2

0

由于您已将“dbo.softwareapplications”表别名为t1,因此您必须在后续子句中引用它:

join dbo.assignments on t1.softwareid = dbo.IQCSassignments.softwareid

(或者,删除“as t1”别名和对它的其他引用。)

于 2013-10-11T18:53:40.623 回答
0

使用您创建的别名:t1.softwareid 而不是 dbo.softwareapplications.softwareid

于 2013-10-11T18:55:34.640 回答