Hi All.
I am trying to seek advice for a complex query. I am logging data to a MSDE SQL table with 2 fields, timestamp and value. timestamp is obviously the time and value is either 1 or 0.
I am trying to get the time difference between the 1 and 0 for each 'pair' and then add up the total. This is for when a machine is stopped.
I am thinking if writing an ADO script but was wondering if a query may be easier but am uncertain how to do this with a query.
The intention is to link each pair with another table to get a reason for the time so ultimatley the machine was stopped for x minutes for y reason is what i am trying to achieve.

Any ideas welcome ty