日期:2014-05-16 浏览次数:20595 次
select
shoes_picture Photo
,c.colthno Article_No
,o.order_quantity Quantity_ordered
,d.rk_nb Quantity_received
,0 TBD
,e.stock_nb
,0 kff
,r.re_order_nb
,w1 = sum(case when b.outdate between '20131202' and convert(char(8) ,dateadd(day,6,convert(date,'20131202')),112) then b.nb else 0 end)
,w2 = sum(case when b.outdate between convert(char(8) ,dateadd(day,7,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,13,convert(date,'20131202')),112) then b.nb else 0 end)
,w3 = sum(case when b.outdate between convert(char(8) ,dateadd(day,14,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,20,convert(date,'20131202')),112) then b.nb else 0 end)
,w4 = sum(case when b.outdate between convert(char(8) ,dateadd(day,21,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,27,convert(date,'20131202')),112) then b.nb else 0 end)
,w5 = sum(case when b.outdate between convert(char(8) ,dateadd(day,28,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,34,convert(date,'20131202')),112) then b.nb else 0 end)
,w6 = sum(case when b.outdate between convert(char(8) ,dateadd(day,35,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,41,convert(date,'20131202')),112) then b.nb else 0 end)
,w7 = sum(case when b.outdate between convert(char(8) ,dateadd(day,42,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,48,convert(date,'20131202')),112) then b.nb else 0 end)
,w8 = sum(case when b.outdate between convert(char(8) ,dateadd(day,49,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,55,convert(date,'20131202')),112) then b.nb else 0 end)
,w9 = sum(case when b.outdate between convert(char(8) ,dateadd(day,56,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,62,convert(date,'20131202')),112) then b.nb else 0 end)
,w10 = sum(case when b.outdate between convert(char(8) ,dateadd(day,63,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,69,convert(date,'20131202')),112) then b.nb else 0 end)
,w11 = sum(case when b.outdate between convert(char(8) ,dateadd(day,70,convert(date,'20131202')),112) and convert(char(8) ,dateadd(day,76,convert(date,'20131202')),112) then b.nb else 0 end)
,w12 = sum(case when b.outdate between convert(char(8) ,dat