MySQL GROUP BY DateTime +/- 3 seconds
问题 Suppose I have a table with 3 columns: id (PK, int) timestamp (datetime) title (text) I have the following records: 1, 2010-01-01 15:00:00, Some Title 2, 2010-01-01 15:00:02, Some Title 3, 2010-01-02 15:00:00, Some Title I need to do a GROUP BY records that are within 3 seconds of each other. For this table, rows 1 and 2 would be grouped together. There is a similar question here: Mysql DateTime group by 15 mins I also found this: http://www.artfulsoftware.com/infotree/queries.php#106 I don't