How to find the longest consecutive series of events in SQL | Hacker News Reader