|
|
select t2.agentnum,t3.abbreviation,t1.amount from (select t1.* from (select t1.sys_enterpriseid,sum(if(t1.status='手工关闭',ifnull(t2.deliedqty,0)*t2.price,t2.amount)) amount from sa_order t1
|
|
|
inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.sa_promotionid=$sa_promotionid$ and t1.siteid=$siteid$ and t1.status in('提交','审核','关闭','手工关闭') group by t1.sys_enterpriseid) t1
|