title: Finding out max number of entries based on a pre-condition in mysql
body: <p>I have a timestamp column which has following time entries...i m writing as alphabets for convenience.</p>
  
  <pre><code>Person    Time
     1       A
     2       B
     3       C
     4       D
     5       E
     5       F
     5       G
     6       H
  </code></pre>
  
  <p>Now the objective is to group all the entries that have a time difference of less than 2 hours between them  which are generated by the same person and the count of elements in that group. </p>
  
  <p>And so if i had say 100 entries....first if i were to consider 10 out of 100 entries then i need to check whether all 10 entries are from the same person then check if first 10 had time difference of less than 2 hours between successive elements...if so then the count is 10....if the time difference between 10th and 11th was more...then 11th wont be counted....and if the successive elements were generated by different person...then they cannot be grouped for calculating count.</p>
  
  <p>so principally its like grouping successive entries which fits this criteria and dividing the table into sets (not breaking the table just grouping) and find out which set has the max count for a person.....so if 86 to 100th entry fit the criteria...then the count is 15 provided 86 to 100 are all generated by same person and if every other set had less than 10...then the output of the query should be the person which provided this max time count </p>