由于工作需要,必须要用perl写。。。。
打印每日各采购大组销售额前30名的商品的程序
sql 是这select store_no,buyer_uid,art_grp_no, art_no,descr, sum(xs), mc
from (
select store_no,buyer_uid,art_grp_no, art_no,descr, sum(sale_amount) xs,
rank()over(partition by store_no,buyer_uid,art_grp_no order by sum(sale_amount) desc) mc from jxc_art where run_date= to_date(&&1,'yyyymmdd') and store_no=10
group by store_no,buyer_uid,art_grp_no, art_no,descr having sum(sale_amount)<>0
)
where mc<=30
group by store_no,buyer_uid,art_grp_no, art_no,descr,mc
order by 1,2,3,7
急急急急急急 |