Select turnedOff/turnedOn time of interruptor in database

Hi,

I have a db table like this :
DATETIME | ON_OFF |
2005-03-23 14:45:00 0
2005-03-23 14:45:15 0
2005-03-23 14:45:30 1
2005-03-23 14:45:45 1
2005-03-23 14:46:00 1
2005-03-23 14:46:15 1
2005-03-23 14:46:30 0
2005-03-23 14:46:45 0
2005-03-23 14:47:00 0
2005-03-23 14:47:15 1
2005-03-23 14:47:30 1
2005-03-23 14:47:45 0
2005-03-23 14:48:00 0
2005-03-23 14:48:15 0

It represent an interruptor on/off sequence.
Iwant to get the datetime off each state variation and know if it's a
turnedOn or a turnedOff value.
I don't see another solution that loop throw a resultSet of select *
query
and detect programmaticaly the changes.

Does someone know a way of doing this with SQL queries ???
Thanks
stephane.riff [ Mi, 23 März 2005 14:51 ] [ ID #710690 ]
Datenbanken » comp.databases.postgresql.sql » Select turnedOff/turnedOn time of interruptor in database

Vorheriges Thema: World First Cancer Immune Booster
Nächstes Thema: Select with substring or regular expression