当前位置: 首页 > news >正文

万宁网站建设天津百度推广公司电话

万宁网站建设,天津百度推广公司电话,微信公众号服务号网站开发流程图,网站小图标怎么做一、timestamp字段与int字段相加 (一)场景 change_time字段是timestamp字段,代表一个红绿灯周期的开始时间(先是绿灯、再是黄灯、最后红灯),而green是int字段,代表绿灯的秒数,现在…

一、timestamp字段与int字段相加

(一)场景

change_time字段是timestamp字段,代表一个红绿灯周期的开始时间(先是绿灯、再是黄灯、最后红灯),而green是int字段,代表绿灯的秒数,现在要求出绿灯的结束时间。即change_time字段+green字段

(二)timestamp字段与int字段无法直接相加,可以先把change_time字段转为时间戳,然后和green字段相加,最后再转为日期

样例:from_unixtime(unix_timestamp(change_time, 'yyyy-MM-dd HH:mm:ss') + green) AS new_timestamp

(三)SQL语句

 成功!!!

二、with语句与insert结合使用

(一)场景

在DWS层中,对多层SQL使用with语句嵌套查询,然后insert插入数据。如果直接把insert放在with语句上面,那么就会如下报错

(二)报错

org.apache.hadoop.hive.ql.parse.ParseException:line 2:0 cannot recognize input near 'with' 'a1' 'as' in statement

(三)解决方法

把insert放在with的后面,select的前面

(四)SQL语句

with a1 as(
selectb1.site_id, b1.phase_id, b1.phase_start, b1.program_id, b1.lane_direction, b1.device_direction,b1.min_gree_end, b1.phase_end, b1.team_id, b1.name,t8.device_no,t9.lane_num lane_no
from  dws_pass as b1
left join hurys_dc_dwd.dwd_radar_config as t8
on t8.direction=b1.device_direction and t8.device_no=b1.device_no  --得到真正的雷达编号字段
left join hurys_dc_dwd.dwd_radar_lane as t9
on t9.device_no=b1.device_no and t9.lane_direction=b1.lane_direction  --得到车道编号字段
group by b1.site_id, b1.phase_id, b1.phase_start, b1.program_id, b1.lane_direction, b1.device_direction, b1.min_gree_end, b1.phase_end, b1.team_id, b1.name, t8.device_no, t9.lane_num)
insert  overwrite  table  dws_pass_sparetime_1hour  partition(day)
selecta1.site_id,phase_id,program_id,phase_start,min_gree_end,phase_end,a1.device_no,team_id,name,t10.create_time,concat(substr(create_time, 1, 14), '00:00') start_time,a1.lane_no,section_no,coil_no,device_direction direction,lane_direction,target_id,target_type,drive_in_time,day
from a1
left join hurys_dc_dwd.dwd_pass as t10
on t10.device_no=a1.device_no and t10.lane_no=a1.lane_noand t10.create_time between a1.min_gree_end and a1.phase_end
group by a1.site_id, phase_id, program_id, phase_start, min_gree_end, phase_end, a1.device_no, team_id, name, t10.create_time, a1.lane_no, section_no, coil_no, device_direction, lane_direction, target_id, target_type, drive_in_time, day
;

http://www.shuangfujiaoyu.com/news/3142.html

相关文章:

  • 北京 网站 建设百度链接收录
  • 济南做网站优化国内永久免费域名注册
  • 四川民主法制建设官方网站佛山seo整站优化
  • 温州网站制作价格南京百度seo公司
  • 西安 网站搭建搜索引擎优化的目的是对用户友好
  • 哪些网站教你做美食的优化推广方案
  • 电子商务网站网站建设关键词快速排名怎么做
  • 江门网站建设费用班级优化大师功能介绍
  • 秒收录网站有哪些成人短期技能培训学校
  • 靠网站建设成功案例网络营销该如何发展
  • 建html5响应式网站的工具seo推广的方法
  • 做网站个人怎么赚钱吗推广平台网站热狗网
  • 部门网站建设宗旨商丘关键词优化推广
  • 网站数据库太大搬家还原500错误厦门百度关键词seo收费
  • 可以做直播的游戏视频网站网站推广工具有哪些
  • 做美女图片网站需要备案吗如何开网站呢
  • wordpress azure ftp网站内部优化有哪些内容
  • 合肥学网站设计友链交换网站
  • 如何建设公司网站知乎360建站和凡科哪个好
  • 分类网站建设方案国外产品推广平台
  • 海南网站建设介绍友情链接交换网
  • 手机上怎么做网站宣传推广方案范文
  • 如何做网站诊断seogw
  • 3322动态域名官网seo神器
  • 怎样做单页微信网站连接网站建站网站
  • dell网站设计特色营销软件网
  • 西安网站建设平台重庆seo整站优化外包服务
  • 网站建设 手机百度知道官网登录入口
  • 西安做网站微信公司哪家好百度百度一下你就知道
  • 男女同房做爰网站免费企业网站建设原则是