2
我有一些我在視圖中連接在一起的表,並且當我想要拉取結果時執行該視圖。我想將一個where子句應用到視圖,以便我的結果由視圖提供,但是當我這樣做時,我得到錯誤多部分標識符無法綁定。SQL Server:在使用VIEW時不能綁定多部分標識符
從視圖中獲取SQL查詢並將其作爲獨立查詢與我的where子句一起運行時,它運行良好,所以我在將where子句應用於我的視圖時遇到問題。
查看
SELECT
dbo.Assets.assetid, dbo.Assets.assetcommonname, dbo.Assets.assetcode,
dbo.Assets.assetserial, dbo.Assets.assetinternallocation, dbo.Assets.assetmodel,
dbo.Assets.assetmake, dbo.Assets.assetmac, dbo.Assets.assetnotes,
dbo.AssetTypes.typename, dbo.Locations.locationame, dbo.Customers.customername,
dbo.Routes.routename, dbo.Locations.customerid
FROM
dbo.Assets
INNER JOIN
dbo.AssetTypes ON dbo.Assets.assettype = dbo.AssetTypes.typeid
INNER JOIN
dbo.Locations ON dbo.Assets.assetlocation = dbo.Locations.locationid
INNER JOIN
dbo.Customers ON dbo.Locations.customerid = dbo.Customers.customerid
INNER JOIN
dbo.Routes ON dbo.Locations.locationroute = dbo.Routes.routeid
如何執行的觀點與我的where子句
select * from afViewassetlinked where (Locations.customerid = '1')
我做了什麼錯?
重要的是,我覺得有多愚蠢。謝謝 – Damo