MySQL query to Select -> Insert and Delete selected rows
问题 I got a system that pings to the database every 2 to 5 seconds, when an user is connected the application. Depending on his connection, the ping timeframe can be bigger, like 10 seconds or so. Example: Pings: 1,4,6,8,9,12,16,20,50,180,187,189,200,203,206,210 ... I'm running a query to grab ranges that does not exceed 1 minute between the pings, group them, so I can tell for how long the user has been connected: Here is the query I'm running to select the results, as advised by @fancyPants on