sqoop:mysql to hdfs

将mysql联合查询的结果导入到hdfs上

sqoop import --connect jdbc:mysql://ip/数据库 --username root --password 密码 --query "select p.bidNo as bidNo,p.interestTime as interestTime,p.status as status,p.planStatus as planStatus,
i.yield as yield,
i.startDate as startDate,
i.endDate as endDate,
i.cycle as cycle,
i.financedAmount as financedAmount,
e.interestType as interestType,
a.penaltyAmount as penaltyAmount,
(
case
when
(select count(1) from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1) > 0
then (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime((select pp.interestTime from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1)))))
else (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime(i.startDate))))
end) as days
from
zx_standard_plan p
left join zx_standard_informations i
on p.bidNo = i.bidNo
left join zx_standard_extra e
on e.bidNo = p.bidNo
left join zx_advance_repay a
on a.bidNo = p.bidNo
where
p.planStatus <> 'VOID' and
i.bidType <> 'GREEN' and
i.bidStatus <> 'FINISHED' and
\$CONDITIONS
order by p.interestTime asc" -m 1 --target-dir /zhongxin/standardPlanStatistics

  

转载于:https://www.cnblogs.com/Smilence1024/p/7999391.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值