Chinaunix

标题: 新手急问 一个小问题 [打印本页]

作者: hisongy    时间: 2011-01-11 18:24
标题: 新手急问 一个小问题
由于工作需要,必须要用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
急急急急急急
作者: langren868    时间: 2011-01-12 15:07
SQL 给你写出这样,也真是无语。。。。。。7在哪,我怎么没看到?

读出来直接屏幕输出就是了。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2