HIVE 注意格式

浏览: 742
SQL

1.,concat(round(cast(finish_rate as decimal)*100,4),'%')  `累计完成率`       ------注意转化格式

,concat(substr(finish_rate*100,1,4),'%') `累计完成率` 

image.png

VERTICA 格式转化

,(case when t1_outtype=3 and to_date(t1_ros_outdate)<=COALESCE(to_date(t1_realbegindate),to_date(t1_dtbegindate),'3000-12-31') then 1 else 0 end )   -- 开课前退班

  ,(case when t1_outtype=3 and to_date(t1_ros_outdate)>COALESCE(to_date(t1_realbegindate),to_date(t1_dtbegindate),'3000-12-31') then 1 else 0 end )        -- 开课后退班


日期拼接

select 

case 

when ros_outtime<>'' then concat(concat(to_char(ros_outdate,'yyyy-MM-dd'),' '), substr(ros_outtime, 0, 9))

else to_char(ros_outdate,'yyyy-MM-dd HH24:mi:ss') end 

from roster



'FY'||substr(to_char(cl.classbelong_start_fyear),3)||(case when cl.classbelong_start_quarterdtl=10 then '暑假' 

when  cl.classbelong_start_quarterdtl=20 then '秋季' 

when  cl.classbelong_start_quarterdtl=21 then '秋上' 

when  cl.classbelong_start_quarterdtl=22 then '秋下' 

when  cl.classbelong_start_quarterdtl=30 then '寒假' 

when  cl.classbelong_start_quarterdtl=40 then '春季'  

when  cl.classbelong_start_quarterdtl=41 then '春上'   

when  cl.classbelong_start_quarterdtl=42 then '春下' 

else '不区分' end) as 班级归属季度,

推荐 0
本文由 DDlucky 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

0 个评论

要回复文章请先登录注册