While researching Oracle Analytics, I came across this query:
select an_id,
a_date,
min(a_date) over (
partition by an_id, trunc(a_date)
order by a_date
range between (2.5/24) preceding and (2.5/24) following
) mn,
max(a_date) over (
partition by an_id, trunc(a_date)
order by a_date
range between (2.5/24) preceding and (2.5/24) following
) mx
from a_table
I believe this finds the min and max dates for a given an_id
and a_date
within a 2.5 hour period.
My question is why does this comparison between a_date
(a date) and 2.5/24
(a number) work and how can it be modified for ranges of days, months, or years?