运行此代码后,我收到此错误:"结束SQL语句后找到的字符"。 当我单独运行这些查询时,两个查询都正常工作。但是当我尝试将它们结合起来时,会出现上面提到的错误说明。
我试过没有;参数之后。但这不是问题。有人知道它是什么吗?
PARAMETERS [Date Of SnapShot] DateTime;
SELECT [SnapShot-CS].Import_Date, Region.Region, Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name, RU_Group.RU_Group, RU.RU_Name, Sum([SnapShot-CS].Volume) AS SumOfVolume, Price.Price, Sum([Volume]*[Price]) AS [P x Q]
FROM (RU_Typ INNER JOIN (RU_Group INNER JOIN (Region INNER JOIN (RU INNER JOIN ((Price INNER JOIN Country ON Price.Country_Code = Country.Code) INNER JOIN Sites ON Country.ID = Sites.FK_Country) ON RU.Product_ID = Price.FK_RU_ID) ON Region.ID = Country.FK_Region) ON RU_Group.RU_Group_ID = RU.FK_RU_Group) ON RU_Typ.ID = RU.FK_RU_Typ) INNER JOIN [SnapShot-CS] ON (Sites.Site_ID = [SnapShot-CS].Site_ID) AND (RU.Product_ID = [SnapShot-CS].RU_ID)
WHERE (((Price.Price_Year)=Year([Date Of SnapShot])) AND (([SnapShot-CS].Import_Date)=[Date Of SnapShot]))
GROUP BY [SnapShot-CS].Import_Date, Region.Region, Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name, RU_Group.RU_Group, RU.RU_Name, Price.Price
ORDER BY Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name, RU_Group.RU_Group, RU.RU_Name
UNION ALL SELECT
PARAMETERS [Date Of SnapShot] DateTime;
SELECT SnapShot.Import_Date, Region.Region, Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name, RU_Group.RU_Group, RU.RU_Name, Sum(SnapShot.Volume) AS SumOfVolume, Price.Price, Sum([Volume]*[Price]) AS [P x Q]
FROM (Region INNER JOIN (Country INNER JOIN Sites ON Country.ID = Sites.FK_Country) ON Region.ID = Country.FK_Region) INNER JOIN ((RU_Typ INNER JOIN (RU_Group INNER JOIN (RU INNER JOIN Price ON RU.Product_ID = Price.FK_RU_ID) ON RU_Group.RU_Group_ID = RU.FK_RU_Group) ON RU_Typ.ID = RU.FK_RU_Typ) INNER JOIN SnapShot ON RU.Product_ID = SnapShot.RU_ID) ON Sites.Site_ID = SnapShot.Site_ID
WHERE (((SnapShot.Import_Date)=[Date Of SnapShot]) AND ((Price.Price_Year)=Year([Date Of SnapShot])) AND ((Price.[Band])=5))
GROUP BY SnapShot.Import_Date, Region.Region, Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name, RU_Group.RU_Group, RU.RU_Name, Price.Price
ORDER BY Country.Country, Sites.Legal_Entity, Sites.Site_Group, Sites.Site, RU_Typ.Typ_Name;