sql语句, 谁帮忙优化一下啊,数据多了太慢啦
select P_ID,P_Name,
(select isnull(sum(POI_Number),0) from dbo.ProductOrderInformation(订单表) where POI_ProductID=P_ID and POI_AddDate between
convert(nvarchar(10),'2011-02-26',120) and convert(nvarchar(10),'2011-07-30',120)) as SumNumber,
(select isnull(sum(POI_Number*POI_Price),0) from dbo.ProductOrderInformation where POI_ProductID=P_ID
and POI_AddDate between convert(nvarchar(10),'2011-02-26',120) and convert(nvarchar(10),'2011-07-30',120)) as SumMoney,
round((select isnull(sum(POI_Number*POI_Price),0) from dbo.ProductOrderInformation where POI_ProductID=P_ID and POI_AddDate between
convert(nvarchar(10),'2011-02-26',120) and convert(nvarchar(10),'2011-07-30',120))/datediff(day,convert(varchar(10),'2011-02-26',120),
convert(varchar(10),'2011-07-30')),2) as EveryMoney,
((select isnull(sum(SOI_Number),0) from dbo.ShopperProductInformation where SOI_PID=P_ID)
+
(select isnull(sum(SP_StockNumber),0) from dbo.StockProductInformation where SP_PID=P_ID)
-
(select isnull(Sum(PDR_Number),0) from dbo.ProductDamagedReturn where PDR_ProductID=P_ID and PDR_Type = 1)
+
(select isnull(Sum(PDR_Number),0) from dbo.ProductDamagedReturn where PDR_ProductID=P_ID and PDR_Type = 2)
+
(select isnull(Sum(PDR_Number),0) from dbo.ProductDamagedReturn where PDR_ProductID=P_ID and PDR_Type = 3)
-
(select isnull(Sum(PDR_Number),0) from dbo.ProductDamagedReturn where PDR_ProductID=P_ID and PDR_Type = 4)
-
(select isnull(Sum(PUT_Number),0) from dbo.StoragePutInformation where PUT_ProductID=P_ID and PUT_Type = 1 or PUT_Type = 2)) as LastNumber
from dbo.ProductInformation(商品表)
where P_ClassID in (select PC_ID from dbo.ProductClass(商品类别) where PC_ParentID=1)