I have a table where I need to group the content on a timestamp. Any record that is less than say 5 minutes from any other record needs to be grouped with that other record.

ID   timestamp
 1   2004-02-02 12:00:00
 2   2004-02-02 12:00:05
 3   2004-02-02 12:05:20
 4   2004-02-02 12:15:00
 5   2004-02-02 12:17:15
 6   2004-02-02 12:21:20

With this recordset I would get:
1 & 2 should be grouped since there's less than 5 minutes between the records
3 will be in a group of its own
4, 5 & 6 is a third group since any record in the group has less than 5 minutes to another record in the group


Is this possible to do in MySQL, and how is it accomplished?



Regards,


Bengt Lindholm



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to