17,377
社区成员
发帖
与我相关
我的任务
分享
select o.order_date as 订单日期,
o.requested_ship_date as 要求发货日期,
o.actual_ship_date as 实际发货日期,
sc.container_id as 箱号,o.order_id as 发货单号,
o.consignee_id as 店铺代码,o.c_company as 店铺,
sum(sc.total_qty) as 装箱数量,
case when sc.status = 'Closed' then '已封箱' else '未封箱' end as 封箱状态,
case when (select lh.status
from wh2.load_detail ld,wh2.load_header lh
where ld.load_id=lh.load_id
and o.order_id=ld.order_id
and sc.container_id=ld.container_id
and rownum = 1
) ='Closed' then '交接完成'
else '未交接'
end as 交接状态
from wh2.orders o, wh2.shipment_container sc
where o.order_id=sc.order_id
and o.actual_ship_date between '2017-10-01' and '2017-10-15'
and sc.total_qty > 0
group by o.order_date,o.requested_ship_date,o.actual_ship_date,o.order_id,o.consignee_id,o.c_company,sc.container_id,sc.status
order by sc.container_id