日期:2014-05-17 浏览次数:20780 次
---1、采购的查询
select YEAR(copurchase.PurDate) AS NF,MONTH(copurchase.PurDate) AS YF,pbMaterial.MaterialID AS WLDM,pbMaterial.MaterialName AS WLName,SUM(coPurchaseDetail.Amount) AS BZSLfrom copurchaseinner join coPurchaseDetail on copurchase.PurNo=coPurchaseDetail.PurNoinner join pbMaterial on coPurchaseDetail.MaterialNo=pbMaterial.MaterialNowhere YEAR(copurchase.PurDate)=2012 and MONTH(copurchase.PurDate)=9 GROUP BY YEAR(PurDate),MONTH(PurDate) ,pbMaterial.MaterialID,pbMaterial.MaterialName
----2、入库的查询
select YEAR(stInStore.InDate) AS NF,MONTH(stInStore.InDate) AS YF, pbMaterial.MaterialID AS WLDM,pbMaterial.MaterialName AS WLName,SUM(stInStoreDetail.OriginalWeight) AS RKZLfrom stInStoreinner join stInStoreDetail on stInStore.InStoreNo=stInStoreDetail.InStoreNoinner join coPurchaseDetail on coPurchaseDetail.DetailNo=stInStoreDetail.PurDetailNoinner join pbMaterial on coPurchaseDetail.MaterialNo=pbMaterial.MaterialNowhere YEAR(stInStore.InDate)=2012 and MONTH(stInStore.InDate)=9 and stInStore.TypeNo=3group by YEAR(stInStore.InDate),MONTH(stInStore.InDate),pbMaterial.MaterialID,pbMaterial.MaterialName
---3、出库的查询
select YEAR(stOutStore.OutDate) AS NF,MONTH(stOutStore.OutDate) AS YF,pbMaterial.MaterialID AS WLDM,pbMaterial.MaterialName AS WLName,SUM(stOutStoreDetail.OriginalWeight) AS CKZLfrom stOutStoreinner join stOutStoreDetail on stOutStore.OutStoreNo=stOutStoreDetail.OutStoreNoinner join pmOrderMaterial on pmOrderMaterial.OrderMaterialNo=stOutStoreDetail.OrderMaterialNoinner join pbMaterial on pbMaterial.MaterialNo=pmOrderMaterial.MaterialNowhere YEAR(stOutStore.OutDate)=2012 and MONTH(stOutStore.OutDate)=9 and stOutStore.TypeNo in (3,33,9,12)group by YEAR(stOutStore.OutDate),MONTH(stOutStore.OutDate),pbMaterial.MaterialID,pbMaterial.MaterialName
select YEAR(copurchase.PurDate) AS NF,
MONTH(copurchase.PurDate) AS YF,
pbMaterial.MaterialID AS WLDM,
pbMaterial.Ma