I have a MySQL table that contains user actions over a given day for all my users. I am trying to construct sessions for these users from this data. My algorithm says "if a user has not made an action for 30s, the session has finished". I have my data in the format of:
User_id | Action | Timestamp
I'm wondering if its possible to use SQL to output the sessions by grouping wherever there is less than a 30s gap between actions carried out by the same user?