Re: Is this possible in sql?

From: Thomas Kellerer <FJIFALSDGVAF_at_spammotel.com>
Date: Wed, 21 May 2008 23:16:06 +0200
Message-ID: <69jhojF33fc28U1@mid.individual.net>


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 Received on Wed May 21 2008 - 16:16:06 CDT

Original text of this message