title: Row by Row processing in SQL
body: <p>I am using Hive SQL server. In my database, I am trying to remove records which have less than 7 days of the gap with the previous record but when removing the record I want to check the gap with a "previous retained record", not with any previous record.</p>
  
  <p><img src="https://i.stack.imgur.com/ycfgQ.jpg" alt="Snapshot of the database:"></p>
  
  <p>I want to retain all the record marked as 1 specifically Rec # 7 Although the gap of 7th record is &lt;7, since the previous record is being removed the gap of 7th with 5th becomes 8.</p>