If i have a table which has a data column, how can i count the time period in hours between the entries. Assuming that 1 row effectively signifies the state change of the previous row. eg
TableA
Name Status(Int) DateTime (DateTiem2)
Bob In '2012-11-22 00:00:00'
Bob Out '2012-11-23 00:00:00'
Bob In '2012-11-24 00:00:00'
Bob Out '2012-11-25 00:00:00'
Bob In '2012-11-26 00:00:00'
Bob Out '2012-11-26 12:30:00'
Bob Absent '2012-11-27 00:00:00'
Bob In '2012-11-27 01:00:00
Jo In '2012-11-22 00:00:00'
Jo Out '2012-11-23 00:00:00'
Jo In '2012-11-24 00:00:00'
Jo Out '2012-11-25 00:00:00'
Jo In '2012-11-26 00:00:00'
Jo Out '2012-11-26 12:30:00'
Jo Absent '2012-11-27 00:00:00'
Jo In '2012-11-27 01:00:00
Totals Query result from Bob In: 60.5 hrs Bob Out: 59.5 hrs Bob Absent: 1 hr Jo In: 60.5 hrs Jo Out: 59.5 hrs Jo Absent: 1 hr