generate days from date range

后端 未结 29 2420
渐次进展
渐次进展 2020-11-21 05:19

I would like to run a query like

select ... as days where `date` is between \'2010-01-20\' and \'2010-01-24\'

And return data like:

29条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 05:53

    try this.

    SELECT TO_DATE('20160210','yyyymmdd') - 1 + LEVEL AS start_day 
    from DUAL
    connect by level <= (TO_DATE('20160228','yyyymmdd') + 1) - TO_DATE('20160210','yyyymmdd') ;
    

提交回复
热议问题