insert overwrite table stk_inventory_status_di
partition(dt)
select
a.inventory_status_id as inventory_status_id,
a.inventory_id as inventory_id ,
'' as site_tp,
'' as sku_id,
b.goods_id as goods_id,
b.goods_sn as goods_sn,
b.goods_attr as goods_attr,
b.attr_value_id as attr_value_id,
b.inventory_type as inventory_tp,
case when b.inventory_type='0'or b.inventory_type='1' or b.inventory_type='5' or b.inventory_type='6' then '1'
when b.inventory_type='2' or b.inventory_type='7' or b.inventory_type='8' then '2'
when b.inventory_type='9' then '3'
end as sku_cat_tp,
'' as order_id,
'' as order_item_id,
a.status as status,
a.user_name as oprtr_nm,
from_unixtime(a.add_time) as crtd_time,
from_unixtime(a.add_time,'yyyyMMdd') as dt
from rs_inventory_status a
join rs_inventory b on a.inventory_id=b.inventory_id
where a.dt='20151214' and from_unixtime(a.add_time,'yyyy-MM-dd')>='2015-06-01' and from_unixtime(a.add_time,'yyyy-MM-dd')<'2015-07-01'
;
|