I want to fill the calendar object which requires start and end date information. I have one column which contains a sequence of dates. Some of the dates are consecutive (ha
with tmp as
(
select
datefield
, dateadd('day',-row_number() over(order by date asc),datefield) as date_group
from table
)
select
min(datefield) as start_date
, max(datefield) as end_date
from tmp
group by date_group