thank you for having time to read my question.
I have a mysql table that logs ON and OFF actions for a sensor each in a row. Is it posible to calculate time between OFF and ON when a new row is added with value ON?
This is my table
Time | Action | Sensor | Duration |
---|---|---|---|
14:06 | OFF | 001 | |
14:06 | OFF | 002 | |
15:32 | OFF | 003 | |
16:41 | ON | 002 | duration between OFF (14:06) and ON (16:41) |
17:58 | ON | 001 | duration between OFF (14:06) and ON (17:58) |
18:02 | OFF | 001 | |
18:14 | ON | 001 | duration between OFF (18:02) and ON (18:14) |
Is this posible? Thanks for your time.