Re: Is this possible in sql?

From: <sheldonlg>
Date: Wed, 21 May 2008 17:24:45 -0400
Message-ID: <Bp-dnQj-2PiCDqnVnZ2dnUVZ_gudnZ2d@giganews.com>


Thomas Kellerer wrote:

> sheldonlg wrote on 21.05.2008 22:51:

>> I want to add FP_ENDDT where ENDDT is either the last day before the
>> next period or the beginning of the next period. I don't really care
>> which, since I will either use "<" or "<=" for the date range.
>>
>> This table is built from another one that the three fields above.
>> What I want to know is whether it is possible, using that reference
>> table, to build my table and have ENDDT populated by looking at the
>> next (or previous) row. All my sql experience has been with a single
>> row or from the entire table. I don't know if it is possible to
>> reference the adjacent row.
> Have a look at the lag() function, that's what you are looking for:
> 
> http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions070.htm#i1327527 
> 

Yes, that is EXACTLY what I am looking for. Thank you very much. Received on Wed May 21 2008 - 16:24:45 CDT

Original text of this message