我試圖將此查詢複製到SQL Server中的視圖中,但我不斷收到錯誤。查詢運行良好,但是當我複製並粘貼到一個視圖我在查詢的底端得到一個錯誤:爲什麼我的視圖在SQL Server中返回無效的對象錯誤
無效的對象名稱BVSFWarehouse.dbo.sf_OPPORTUNITYHISTORY「
我是什麼做錯了?請幫忙。
SELECT
H.OpportunityID, H.CREATEDDATE, H.STAGENAME AS 'Q1-14 Stage',
H.CLOSEDATE AS 'Q1-14 Close Date'
FROM
(SELECT
OpportunityID, MAX(CREATEDDATE) AS MaxDate
FROM
BVSFWarehouse.dbo.sf_OPPORTUNITYHISTORY
WHERE
(CREATEDDATE <= '2013-05-01')
GROUP BY
OpportunityID) AS X
INNER JOIN
**BVSFWarehouse.dbo.sf_OPPORTUNITYHISTORY** AS H ON H.OpportunityID = X.OpportunityID
AND X.MaxDate = H.CREATEDDATE