1、获取当前时间的月份,并且把日期转为20221007模式(presto)
select replace(substr(cast (current_timestamp as varchar),1,7),'-','');

2、求每个月上新的sql代码(presto)
select
$date_no$ date_time,
'上新总数' type,
sum((case when month_date = '202201' then total_sum else 0 end )) January,
sum((case when month_date = '202202' then total_sum else 0 end) )
本文总结了使用Presto和Hive进行日期处理的经验,包括:使用Presto获取当前月份并转换日期格式为20221007,编写Presto SQL获取每月新增数据,利用Hive查询最近7天时间范围,以及在Hive中统计每年各月指标数据。
最低0.47元/天 解锁文章
53

被折叠的 条评论
为什么被折叠?



