互联网电商大数据环境 ——大数飓数据分析实践培训精华笔记(七)——电商核心业务知识之订单商品模块
2015-08-14 13:26
806 查看
订单宽表
#!/bin/bash
#======
#dm_b2c_orders.sh 这里用shell来调
#订单宽表——两个表关联
#======
DT=`date -d '-1 day'
"+%Y-%m-%d" `注意date -d ‘-1 day’表示取前一天
或者sysdate=`date "+%Y-%m-%d"`脚本传参数法
if [$1]; then
DT=$1
fi
SQL="
insert overwrite tableitqsc.dm_b2c_orders partition (dt=' "${DT}" ')
select
a.order_id,
a.order_no,
a.order_date,
a.user_id,
a.user_name,
a.order_money,
a.order_type,
a.order_status,
a.pay_type,
a.pay_status,
a.order_source,
b.consignee,
b.area_id,
b.area_name,
b.address,
b.mobilephone,
b.telephone,
b.coupon_id,
b.coupon_money,
b.carriage_money,
b.create_time,
a.last_update_time,
'sysdate()' dw_date (取当前系统时间)
或者'”${sysdate}” ' dw_date(取当前系统时间)
from (select * from itqsc.ods_b2c_orderswheredt='"${DT}"')a
join (select * fromitqsc.ods_b2c_orders_descwhere
dt='"${DT}"') b
on (a.order_id = b.order_id) limit 12;加limit遏抑数据滚屏
"
echo "${SQL}"
hive –e "$SQL"
#!/bin/bash
#======
#dm_b2c_orders_goods.sh 这里用shell来调
#订单与商品宽表——三个表关联
#======
DT=`date -d '-1 day'
"+%Y-%m-%d" `注意date -d ‘-1 day’表示取前一天
或者sysdate=`date "+%Y-%m-%d"`脚本传参数法
if [$1]; then
DT=$1
fi
SQL="
insert overwrite tableitqsc.dm_b2c_orders_goods partition (dt=' "${DT}" ')
select
a.order_id,
b.goods_id,
b.cat_id,
b.cat_name,
b.size_id,
b.goods_price,
b.goods_amount,
a.order_no,
a.order_date,
a.user_id,
a.user_name,
a.order_money,
a.order_type,
a.order_status,
a.pay_type,
a.pay_status,
a.order_source,
c.coupon_id,
c.coupon_money,
c.carriage_money,
sysdate() dw_date (取当前系统时间)
from (select * from itqsc.ods_b2c_orderswheredt='"${DT}"')a
join (select * fromitqsc.ods_b2c_orders_goodswhere
dt='"${DT}"') b
on (a.order_id = b.order_id)
join (select * fromitqsc.ods_b2c_orders_descwhere
dt='"${DT}"') c
on (a.order_id = c.order_id);
"
echo "${SQL}"
hive –e "$SQL"
#!/bin/bash
#======
#dm_b2c_orders.sh 这里用shell来调
#订单宽表——两个表关联
#======
DT=`date -d '-1 day'
"+%Y-%m-%d" `注意date -d ‘-1 day’表示取前一天
或者sysdate=`date "+%Y-%m-%d"`脚本传参数法
if [$1]; then
DT=$1
fi
SQL="
insert overwrite tableitqsc.dm_b2c_orders partition (dt=' "${DT}" ')
select
a.order_id,
a.order_no,
a.order_date,
a.user_id,
a.user_name,
a.order_money,
a.order_type,
a.order_status,
a.pay_type,
a.pay_status,
a.order_source,
b.consignee,
b.area_id,
b.area_name,
b.address,
b.mobilephone,
b.telephone,
b.coupon_id,
b.coupon_money,
b.carriage_money,
b.create_time,
a.last_update_time,
'sysdate()' dw_date (取当前系统时间)
或者'”${sysdate}” ' dw_date(取当前系统时间)
from (select * from itqsc.ods_b2c_orderswheredt='"${DT}"')a
join (select * fromitqsc.ods_b2c_orders_descwhere
dt='"${DT}"') b
on (a.order_id = b.order_id) limit 12;加limit遏抑数据滚屏
"
echo "${SQL}"
hive –e "$SQL"
#!/bin/bash
#======
#dm_b2c_orders_goods.sh 这里用shell来调
#订单与商品宽表——三个表关联
#======
DT=`date -d '-1 day'
"+%Y-%m-%d" `注意date -d ‘-1 day’表示取前一天
或者sysdate=`date "+%Y-%m-%d"`脚本传参数法
if [$1]; then
DT=$1
fi
SQL="
insert overwrite tableitqsc.dm_b2c_orders_goods partition (dt=' "${DT}" ')
select
a.order_id,
b.goods_id,
b.cat_id,
b.cat_name,
b.size_id,
b.goods_price,
b.goods_amount,
a.order_no,
a.order_date,
a.user_id,
a.user_name,
a.order_money,
a.order_type,
a.order_status,
a.pay_type,
a.pay_status,
a.order_source,
c.coupon_id,
c.coupon_money,
c.carriage_money,
sysdate() dw_date (取当前系统时间)
from (select * from itqsc.ods_b2c_orderswheredt='"${DT}"')a
join (select * fromitqsc.ods_b2c_orders_goodswhere
dt='"${DT}"') b
on (a.order_id = b.order_id)
join (select * fromitqsc.ods_b2c_orders_descwhere
dt='"${DT}"') c
on (a.order_id = c.order_id);
"
echo "${SQL}"
hive –e "$SQL"
相关文章推荐
- QPcore服务耍流氓——上市公司的产品策略为何是牺牲用户利益?
- 刘备是怎样“融资”创业的?
- 阿里影业,马云“内外兼修”的一步棋
- 入行必读:互联网行业薪酬等级!看看你值多少钱?
- 互联网电商大数据环境 ——大数飓数据分析实践培训精华笔记(六)——电商核心业务知识之订单商品模块
- 互联网公司的几种“死法”
- SSH原理与运用
- 生活服务落地:互联网+与O2O新媒体的机会
- 互联网时代学习iOS开发好吗
- “互联网+教育”颠覆旧教育生态重建新教育生态
- 互联网的几种死法
- 热爱编程 (转自互联网)
- 互联网协议入门(2)
- 为什么比尔盖茨不挣完所有互联网生意可以赚的钱?
- 互联网社会建设
- 互联网协议入门(1)
- 移动互联网时代,学iOS开发好吗
- 互联网公式笔试中经常遇到的问题
- 互联网流媒体内容分发方式概述
- 国产手机出海:提着互联网灯笼去印度