Have you tried to do this at all? Do you want to pass in a typeId, and have the query return all the ids that are less than one minute apart?
The problem is that you will just get a sorted list, you would still need to parse it in a program, as you will get, in a very contrived example, where monDateTime is a variant of a unit timestamp, for ease of typing.
id=1, monDateTime=3
id=5, monDateTime=57
id=2, monDateTime=63
id=3, monDateTime=120
So, you would need to determine in your application that the first two are one group, but the second and third are a group, so id=2 and 5 are in two groups.
If you loop through in a program and state that I want all the ids that are within a minute of a specific id
and typeId
then you can organize it in the program.
Then you can just use the TimeDiff
function to subtract your specific id and the ids in the database:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timediff