I have read with interest the following blog post about simulating rownum in MySQL:
http://craftycodeblog.com/2010/09/13/rownum-simulation-with-mysql/
I want to extend this concept my having the row number reset on a certain condition being met, i.e. some other column changes value, so the result will look like this:
  id | date       | rownum
-----+------------+--------
   1 | 2013-03-20 |      1
   2 | 2013-03-20 |      2
   3 | 2013-03-20 |      3
   4 | 2013-03-21 |      1   <-- rownum resets because date changes
   5 | 2013-03-21 |      2
   6 | 2013-03-21 |      3
   7 | 2013-03-22 |      1
   8 | 2013-03-22 |      2
I've been trying to figure this out for hours now, without anything satisfactory to show for it. Any help would be appreciated!
 
     
    