title: SQL Query to group and add time between consecutive rows
body: <p>Need help with SQL Query (MySQL)</p>
  
  <p>Say I have a table with data as..</p>
  
  <p><img src="https://i.stack.imgur.com/iF6F7.png" alt="enter image description here"></p>
  
  <p>The table has the Latitude and Longitude locations logged for a person at some time intervals (TIME column), And DISTANCE_TRAVELLED column has the distance traveled from its previous record.</p>
  
  <p>If i want to know how many minutes a person was not moving (i.e DISTANCE_TRAVEKLLED &lt;= 0.001)
  what query should i use?</p>
  
  <p>Can we also group the data by Date? Basically i want to know how many minutes the person was idle in a specific day.</p>