码迷,mamicode.com
首页 > 其他好文 > 详细

【数据处理】20商品销售匹配

时间:2014-09-14 15:16:07      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:ar   数据   2014   sp   on   c   ef   r   bs   

select a.pluno,a.pluname,a.spec,a.qty,d.qty,e.qty,a.dptno,substring(a.dptno,1,3),f.dptname,substring(a.dptno,1,4),g.dptname,substring(a.dptno,1,5),h.dptname
from lhxs201402 a
left join lhspm b on a.pluno=b.pluid
left join xbspm c on b.barcode=c.bcd
left join (select pluno,sum(qty) qty from xbxs where rq between ‘20140601‘ and ‘20140914‘ group by pluno ) d on c.pluno=d.pluno
left join (select pluno,sum(qty) qty from dbxs where rq between ‘20140601‘ and ‘20140914‘ group by pluno ) e on c.pluno=e.pluno
left join lhflm f on substring(a.dptno,1,3)=f.dptno
left join lhflm g on substring(a.dptno,1,4)=g.dptno
left join lhflm h on substring(a.dptno,1,5)=h.dptno

【数据处理】20商品销售匹配

标签:ar   数据   2014   sp   on   c   ef   r   bs   

原文地址:http://www.cnblogs.com/nlg3413/p/3971036.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!