Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Find rows with a change in a field compared with the previous row

Find rows with a change in a field compared with the previous row

From: Björn Wächter <Bjoern.Waechter_at_p3-solutions.de>
Date: Mon, 6 Jun 2005 15:58:51 +0200
Message-ID: <3gj35bFcctikU1@news.dfncis.de>


Hi all,

I have a Table like

SESSION_ID | LIGHT_ON


1          | Y
2          | Y
3          | Y
4          | Y
5          | N
6          | N
7          | N
8          | Y
9          | Y
10         | Y
11         | Y
12         | Y
13         | Y
14         | N
15         | N


I'm interested in the rows where
the status of the light changed.
For example:

SESSION_ID | STATUS


5          | OFF
8          | ON
14         | OFF


Is there a way to do this with simple SQL?

Thanks Björn



Dipl.-Ing. Björn Wächter
P3 Solutions GmbH
Dennewartstr. 25-27
D-52068 Aachen
Germany
http://www.p3-solutions.com

tel +49(0)241/9437-417
fax +49(0)241/9437-431 Received on Mon Jun 06 2005 - 08:58:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US