Here is the lowdown:
I’m putting together some reports on data that FSQL is collecting for us. I need to get the time from one event to the next using the timestamps. I think it can be done in a SQL statement rather than a stored procedure.
The table has an index, t_stamp, and MachineState columns. In my report, I will be taking the amount of time spent in each state and summing them, which means I need to do a DATEDIFF on the current row’s timestamp and the next row’s timestamp to find the amount of time spent in each state. The last state can be ignored, I take care of that elsewhere.
I know what I want but I just can’t get it out of my brain! Any ideas?