Browse Source

订货额趋势查询优化(查询近两年的数据)

hu 1 year ago
parent
commit
434e11b7bd

+ 1 - 1
src/custom/restcontroller/webmanage/sale/databoard/SQL/销售单量统计查询_月份.sql

@@ -1 +1 @@
-select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,CAST(count(1) AS DECIMAL(16,0)) typestatistics from sa_order t1 where t1.status not in('新建','提交') and t1.siteid =$siteid$ and $where$  group by DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')
+select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,CAST(count(1) AS DECIMAL(16,0)) typestatistics from sa_order t1 where t1.status not in('新建','提交') and t1.siteid =$siteid$ and $where$ and t1.checkdate >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) group by DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')

+ 1 - 1
src/custom/restcontroller/webmanage/sale/databoard/SQL/销售额统计查询_月份.sql

@@ -1,2 +1,2 @@
-select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,cast(ifnull(sum(if(t2.isclose,t2.deliedqty*t2.price,t2.amount)),0) AS DECIMAL(16,6)) typestatistics  from sa_order t1 inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.siteid=$siteid$ and t1.status not in('新建','提交') and $where$  group by  DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')
+select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,cast(ifnull(sum(if(t2.isclose,t2.deliedqty*t2.price,t2.amount)),0) AS DECIMAL(16,6)) typestatistics  from sa_order t1 inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.siteid=$siteid$ and t1.status not in('新建','提交') and $where$ and t1.checkdate >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)  group by  DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')