generate days from date range

后端 未结 29 2429
渐次进展
渐次进展 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:57

    For Oracle, my solution is:

    select trunc(sysdate-dayincrement, 'DD') 
      from dual, (select level as dayincrement 
                    from dual connect by level <= 30)
    

    Sysdate can be changed to specific date and level number can be changed to give more dates.

提交回复
热议问题