将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

  

最新文章

  1. ASP.NET Aries 4.0 开源发布:已完成基础功能优化重写
  2. sqlplus连接oracle失败分析和解决
  3. Spring Boot 框架@Temporal(TemporalType.DATE)
  4. PO、VO、BO、DTO、POJO、DAO
  5. MonoDevelop编辑器中文乱码解决
  6. 利用WebService发布图片文件
  7. PyDev-Python的Eclipse插件安装
  8. 【python】 web开发入门
  9. PhpStorm 4.0 &amp; 5.0 部署本地Web应用
  10. Extjs 4.2 右键菜单树节点(,选择逆,废除)
  11. 《算法导论》习题2.3-7 查找集合S中是否有两个元素和为X---Java实现
  12. Problem 2144 Shooting Game fzu
  13. 在IDEA中实战Git(转载自)
  14. 解决使用微软模拟器VS Emulator for Android在VS2017 Xamarin开发中不能调试程序的问题。
  15. Java字节码里的invoke操作&amp;&amp;编译时的静态绑定与动态绑定
  16. Python根据多个空格Split字符串
  17. C++.构造函数(超出范围)_01
  18. Django之WSGI 和MVC/MTV
  19. synchronized细节问题(一)
  20. JQuery 常用知识

热门文章

  1. 修改XCode默认工程为使用Xib
  2. SpringBoot学习之Json数据交互
  3. php+redis 学习 五 消息推送
  4. LocalMaxima_NOI导刊2009提高(1)
  5. TKCPP
  6. Redis 持久化和配置文件
  7. LVS结合keepalived配置测试
  8. 洛谷 P4016负载平衡问题【费用流】题解+AC代码
  9. 高可用之KeepAlived(一):基本概念和配置文件分析
  10. bzoj 2073 暴力