Hi All,
I'm looking for a way to mimic Oracle first_value/last_value functions with DB2.
More precisely the concern is to generate an equivalent for the following piece of SQL:
select t0.KeyCol as T0_KeyCol,
(select last_value(t2.TargetCol) over (order by t2.OrderingCol)
from LogsTable t2 where (t2.KeyCol = t0.KeyCol) and (rownum=1)) as TheLastValue
from BaseTable t0
Basically, it fetches from, let's say, a logs table the first/last occurence of a given event for each individual of a base reference table.
Any suggestion will help.
Thanks.