On 3/14/08, BandIT <[EMAIL PROTECTED]> wrote:
>
>  I have a table:
>
>  CREATE TABLE Log
>  (
>   TimeStamp char(14),  -> Format YYYYMMDDHHNNSS
>   Code char(5),    -> 5 digit status code
>  )
>
>  example:
>
>  20080314100030 A0001
>  20080314101000 A0002
>  20080314101700 A0000
>  20080314102000 A0002
>  20080314102100 A0000
>
>  I would like a query to output the the time between the status codes (sum)
>  to know how long each status has been active. I am not so very familiar with
>  SQL and SQLite, and I hope I am posting to the correct forum.

SELECT Code, max(TimeStamp) -min(TimeStamp) AS TimePassed
FROM Log
GROUP BY Code;

>
>  Is this possible? Any hints and ideas are welcome!
>
> --
>  View this message in context: 
> http://www.nabble.com/Value-between-changes-tp16048109p16048109.html
>  Sent from the SQLite mailing list archive at Nabble.com.
>
>  _______________________________________________
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to