分享到:
发表于 2016-08-21 01:38:21 楼主 | |
求助:请大侠帮我写这个定时导出查询结果到EXCEL的语句 请大侠帮我把下面查询语句改写为可以做到SQL“作业”中定时执行的语句! --查询区域FCS+总件数语句 查询完输出到D:每个品牌每个区域.XLS select e.zipcode,f.name_short,convert(char(6),a.time_conf,112) as ymth,c.classid,c.name_class,count( distinct a.custid ) as 客户数,count(distinct b.shopid) as SKU数, sum(b.value_ok) as [成交额],sum (b.num_in / d.num_box) as [成交件数] from t_bp_wsalebrk_h a with(nolock), t_bp_wsalebrk_d b with(nolock) , t_bp_class c with(nolock), t_bp_shop d with(nolock), t_bp_cust e with(nolock), t_bp_wsalewrkgroup f with(nolock) where a.bill = b.bill and b.shopid = d.shopid and e.zipcode=f.groupid and left(d.classid,len(c.classid)) = c.classid and a.flag_conf = '1' and a.custid = e.custid and a.time_conf >= '2010-01-01' and a.time_conf < '当天日期’ --修改起止时间 and c.classid like '0%' and c.remark like '%基本%' group by e.zipcode,f.name_short,convert(char(6),a.time_conf,112),c.classid,c.name_class order by e.zipcode,c.classid |
|
楼主热贴
个性签名:无
|
针对ZOL星空(中国)您有任何使用问题和建议 您可以 联系星空(中国)管理员 、 查看帮助 或 给我提意见