By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

DB2 equivalent For Oracle first_value/last_value functions

P: 1
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.

Mar 27 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.