报表SQL语句整理

报表SQL语句整理

ID:30501640

大小:187.00 KB

页数:6页

时间:2018-12-30

报表SQL语句整理_第1页
报表SQL语句整理_第2页
报表SQL语句整理_第3页
报表SQL语句整理_第4页
报表SQL语句整理_第5页
资源描述:

《报表SQL语句整理》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、报表SQL语句整理selectdbo.fun_money2str(SUM(PurchaseAmount))PurchaseAmount,dbo.fun_money2str(SUM(DistributeAmount))DistributeAmount,dbo.fun_money2str(SUM(WarehouseAmount))WarehouseAmount,dbo.fun_money2str(SUM(PayedAmount))PayedAmount,dbo.fun_money2str(SUM(WithdrawAmount))

2、WithdrawAmount,count(DistinctDistributorID)DistributorCountfromdbo.REP_DistributorAreaMedtypedamjoinfunGetSubZoneByUID('CGZX',0)SZONdam.ZoneID=SZ.ZoneIDjoinfunGetSubMedtype('YPLY',1)gsmondam.MedicineTypeId=gsm.MedicineTypeIdwhere1=1ANDOrderYear=2012selectOrderMonth

3、,HM.MedicineTypeID,HM.MedicineTypeName,dbo.fun_money2str(SUM(PurchaseAmount))PurchaseAmount,dbo.fun_money2str(SUM(DistributeAmount))DistributeAmount,dbo.fun_money2str(SUM(WithdrawAmount))WithdrawAmountfromREP_DistributorAreaMedtypeHMjoinfunGetSubZoneByUID('CGZX',0)

4、SZONHM.ZoneID=SZ.ZoneIDjoinfunGetSubMedtype('YPLY',1)gsmonHM.MedicineTypeId=gsm.MedicineTypeIdwhere1=1ANDOrderYear=2012GROUPBYOrderMonth,HM.MedicineTypeID,HM.MedicineTypeNameorderbyOrderMonth,HM.MedicineTypeName6selectSUBSTRING(CONVERT(VARCHAR(12),OrderMonth),0,5)+

5、'年'+CONVERT(VARCHAR(2),((OrderMonth%100-1)/3+1))+'季度'ASQuarters,dam.MedicineTypeID,dam.MedicineTypeName,dbo.fun_money2str(SUM(PurchaseAmount))PurchaseAmount,dbo.fun_money2str(SUM(DistributeAmount))DistributeAmount,dbo.fun_money2str(SUM(PayedAmount))PayedAmount,dbo.

6、fun_money2str(SUM(WithdrawAmount))WithdrawAmountfromREP_DistributorAreaMedtypedamjoinfunGetSubZoneByUID('CGZX',1)SZONdam.ZoneID=SZ.ZoneIDjoinfunGetSubMedtype('YPLY',1)gsmondam.MedicineTypeId=gsm.MedicineTypeIdwhere1=1ANDOrderYear=2012GROUPBYSUBSTRING(CONVERT(VARCHA

7、R(12),OrderMonth),0,5)+'年'+CONVERT(VARCHAR(2),((OrderMonth%100-1)/3+1))+'季度',dam.MedicineTypeID,dam.MedicineTypeNameorderbyQuarters,dam.MedicineTypeName6selectOrderCount,PurchaseCount,PurchaseAmount,DistributeAmount,WarehouseCount,WarehouseAmount,PayedCount,PayedAm

8、ount,WithdrawCount,WithdrawAmount,StatisticZoneName,DistributorCount,HospitalCount,FactoryCountfrom(selectdbo.fun_money2str(SUM(PurchaseAmount))P

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。