Search code examples
sqlexasol

List of days between two dates in Exasol


In PostgreSQL, it's fairly easy to generate a list of all days between two dates:

>>> select generate_series('2013-01-01'::date, '2013-01-06'::date, '1 day'::interval)::date i;

i
2013-01-01
2013-01-02
2013-01-03
2013-01-04
2013-01-05
2013-01-06

Is it possible to achieve the same result in Exasol?


Solution

  • You can use connect by to generate numbers and then convert that to dates:

    with n as (
          select level - 1 as n
          from dual
          connect by level < 6
         )
    select add_days(date '2013-01-01', n.n)
    from n;