タイトルのエラーのために動作を停止した次のスクリプトがあります。誰か助けてもらえますか?
SELECT DISTINCT TOP 100 PERCENT
Locs.lCustomerGroupPK, Locs.lCustomerID, Locs.Customer_Group_Name, Locs.Customer_Name, Locs.Location_Name, TY.ThisYearsSales,
(SELECT ThisYearsSales
FROM dbo.Vw_Level_3_Sales_This_Year
WHERE (lLocationID = Locs.lLocationID2 OR lLocationID = Locs.llocationid)
AND (Current_Read_Date = TY.Current_Read_Date - 364) AND (ThisYearsSales <= 400)
) AS LastYearsSales,
TY.Current_Read_Date - 1 AS Current_Read_Date INTO #tmplocationlflsales
FROM dbo.Vw_Level_3_Sales_This_Year AS TY
INNER JOIN dbo.vw_locations_Like_For_Like_Previous AS Locs
ON TY.lLocationID = Locs.llocationid OR TY.lLocationID = Locs.lLocationID2
WHERE (TY.ThisYearsSales <= 400)
AND (TY.Current_Read_Date = @RecordDate)
AND TY.ThisYearsSales IS NOT NULL
AND (SELECT ThisYearsSales
FROM dbo.Vw_Level_3_Sales_This_Year
WHERE (lLocationID = Locs.lLocationID2 OR lLocationID = Locs.llocationid)
AND (Current_Read_Date = TY.Current_Read_Date - 364)
AND (ThisYearsSales <= 400)
) IS NOT NULL
ORDER BY Locs.Customer_Group_Name, Locs.Customer_Name, Locs.Location_Name, Current_Read_Date