I have a database where a column called StatusMotor is so:
+++++++++++++++++++++++++++++++
+ Date-time + MotorStatus+
+++++++++++++++++++++++++++++++
+ 03-02-20 18:35 + Start +
+ 03-02-20 18:35 + Start +
+ 03-02-20 18:36 + Start +
+ 03-02-20 18:35 + Start +
+ 03-02-20 18:36 + Start +
+ 03-02-20 18:36 + Start +
+ 03-02-20 18:36 + Stop +
+ 03-02-20 18:36 + Stop +
+ 03-02-20 18:36 + Stop +
+ 03-02-20 18:36 + Standby +
+ 03-02-20 18:37 + Standby +
+ 03-02-20 18:37 + Start +
+ ... + ....
I have three status (START, STOP, STAND BY) and i would extract moments when Motor works:
the date-time when i have 1st Start or Start after a Stop and Standby, and when I have last start before a Stop or Standby.
select DateTime, MotorStatus
from TableName
Where MotorStatus like 'Start' and...
I don't know what condition i put to have this range. How i could to do?
