Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail
From: "Björn Wächter" <Bjoern.Waechter@p3-solutions.de>
Newsgroups: comp.databases.oracle.misc
Subject: Find rows with a change in a field compared with the previous row
Date: Mon, 6 Jun 2005 15:58:51 +0200
Lines: 61
Message-ID: <3gj35bFcctikU1@news.dfncis.de>
X-Trace: news.dfncis.de G3hddz9aUmLdscdx57pnjgWqnq4azVzRDUmAvm2IBgQTUmHOcs6WqlZPph
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:119653

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


