如上图,已知日期2022-01-01, 需要获得以2022-01-01为终点的10天的连续时间序列
附代码如下:

select date_add(dateadd(to_date('20220101','yyyymmdd'), 9, 'dd'), a.pos) as special_date
    from (select posexplode(split(repeat(" ", datediff(to_date('20220101','yyyymmdd'), 
dateadd(to_date('20220101','yyyymmdd'), 9, 'dd'))), " "))) a
posted on 2022-01-20 12:19  robynn  阅读(395)  评论(0编辑  收藏  举报