Generate dates between ranges in Firebird

Asked

Viewed 282 times

0

I need to select and return a date range in Firebird. It should be the same logic as generate_series postgresql.

SELECT date_trunc('day', dd):: date FROM generate_series( '2019-07-22'::timestamp, '2019-07-24'::timestamp, '1 day'::interval) dd

Does anyone know how? Note: I need to do it in select, no need for functions or anything like that...

1 answer

0


Solved using recursive!

with recursive dt as (
  select cast('2019-07-22' as date) as dt
  from rdb$database
  union all
  select dt.dt + 1
  from dt
  where dt < cast('2019-07-24' as date)) select dt.dt from dt

Browser other questions tagged

You are not signed in. Login or sign up in order to post.