hive计算指定日期的周一与周末(结束)
--周一/周末selectdistinct date_time as week_start,date_add(date_time,1 - case when DAYOFWEEK(date_time) = 1 then 7 else DAYOFWEEK(date_time) - 1 end ) as week_start,date_add(date_time,7 - case when DAYOFWEEK(date_time) = 1 then 7 else DAYOFWEEK(date_time) - 1 end ) as week_endfrom table_name where ds = '${bdp.system.bizdate}'
发布评论