Scheme
create table stories ( storyid int auto_increment primary key, theDate date not null, votes int not null ); insert stories(theDate,votes) values ('2015-03-10',1), ('2015-03-10',2), ('2015-03-09',5), ('2015-03-09',3), ('2015-03-10',51), ('2015-03-10',26), ('2015-03-09',75), ('2015-03-09',2), ('2015-03-10',12), ('2015-03-10',32), ('2015-03-09',51), ('2015-03-09',63), ('2015-03-10',1), ('2015-03-10',11), ('2015-03-09',5), ('2015-03-09',21), ('2015-03-10',1), ('2015-03-10',2), ('2015-03-09',5), ('2015-03-09',3), ('2015-03-10',51), ('2015-03-10',26), ('2015-03-09',75), ('2015-03-09',2), ('2015-03-10',12), ('2015-03-10',44), ('2015-03-09',11), ('2015-03-09',7), ('2015-03-10',19), ('2015-03-10',7), ('2015-03-09',51), ('2015-03-09',79);
Request
set @rn := 0, @thedate := ''; select theDate, votes from ( select storyid, theDate, votes, @rn := if(@thedate = theDate, @rn + 1, 1) as rownum, @thedate := theDate as not_used from stories order by theDate, votes desc ) A where A.rownum <= 10;
results
+------------+-------+ | theDate | votes | +------------+-------+ | 2015-03-09 | 79 | | 2015-03-09 | 75 | | 2015-03-09 | 75 | | 2015-03-09 | 63 | | 2015-03-09 | 51 | | 2015-03-09 | 51 | | 2015-03-09 | 21 | | 2015-03-09 | 11 | | 2015-03-09 | 7 | | 2015-03-09 | 5 | | 2015-03-10 | 51 | | 2015-03-10 | 51 | | 2015-03-10 | 44 | | 2015-03-10 | 32 | | 2015-03-10 | 26 | | 2015-03-10 | 26 | | 2015-03-10 | 19 | | 2015-03-10 | 12 | | 2015-03-10 | 12 | | 2015-03-10 | 11 | +------------+-------+ 20 rows in set, 1 warning (0.00 sec)