|
|
-select t3.marketingcategory,sum(cast(ifnull(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 left join plm_item t3 on t2.itemid=t3.itemid and t2.siteid=t3.siteid where t1.siteid=$siteid$ and $where$ and t1.status not in('新建','提交') group by t3.marketingcategory) t1 left join plm_itemclass t2 on t1.marketingcategory=t2.itemclassid
|
|
|
+select ifnull(t4.itemclassname,'其他') marketingcategory,sum(cast(ifnull(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 left join plm_item t3 on t2.itemid=t3.itemid and t2.siteid=t3.siteid left join plm_itemclass t4 on t3.marketingcategory=t4.itemclassid where t1.siteid=$siteid$ and $where$ and t1.status not in('新建','提交') group by t4.itemclassname
|