View Single Post

   
  #2 (permalink)  
Old 03-04-2008, 07:23 AM
Serge Rielau
 
Posts: n/a
Default Re: help for operation with date

DM wrote:
> Hi all,
> I've a table like this:
> date, value
> 01/01/2008, 3
> 01/02/2008, 4
> 02/03/2008, 7
>
> and I wish to find with one query the difference (in days) from all
> the consecutive intervals (01/02 - 01/01 and 02/03 - 01/02 in this
> example).
>
> Someone could help me please?
> Thanks all,
> DM

Take a look at the OLAP functions. Especially the ROWS PRECEEDING
clause. They allow you to dip into trailing or leading rows.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Reply With Quote