SELECT FactOrders.TerritoryKey ,
FactOrders.DistributorKey ,
FactOrders.ItemKey ,
SUM(FactOrders.UnitQty)as Quantity ,
SUM(FactOrders.GrossValue) as Gross_Value
FROM FactOrders
WHERE FactOrders.TerritoryKey = @TerritoryKey and
FactOrders.DistributorKey = @DistributorKey and
FactOrders.DateKey >=CInt(Format(Paramters!@Date1.Value,"yyyyMMdd")) and
FactOrders.DateKey <= @Date2 AND
FactOrders.LineType = 'ORDER'
GROUP BY FactOrders.TerritoryKey , FactOrders.DistributorKey ,FactOrders.ItemKey
ORDER BY FactOrders.TerritoryKey , FactOrders.DistributorKey ,FactOrders.ItemKey
答案 0 :(得分:0)
我试过这样就检查一下
SELECT FactOrders.TerritoryKey ,
FactOrders.DistributorKey ,
FactOrders.ItemKey ,
SUM(FactOrders.UnitQty)as Quantity ,
SUM(FactOrders.GrossValue) as Gross_Value
FROM FactOrders
WHERE FactOrders.TerritoryKey = @TerritoryKey and
FactOrders.DistributorKey = @DistributorKey and
---- FactOrders.DateKey >=CInt(Format(Paramters!@Date1.Value,"yyyyMMdd")) and
CONVERT(varchar(8),CAST(@date1 AS DATE),112)
FactOrders.DateKey <= @Date2 AND
FactOrders.LineType = 'ORDER'
GROUP BY FactOrders.TerritoryKey , FactOrders.DistributorKey ,FactOrders.ItemKey
ORDER BY FactOrders.TerritoryKey , FactOrders.DistributorKey ,FactOrders.ItemKey