How can I return what would effectively be a "contiguous" GROUP BY in MySQL. In other words a GROUP BY that respects the order of the recordset?
For example, SELECT MIN(col1), col2, COUNT(*) FROM table GROUP BY col2 ORDER BY col1
from the following table where col1 is a unique ordered index:
1 a 2 a 3 b 4 b 5 a 6 a
returns:
1 a 4 3 b 2
but I need to return the following:
1 a 2 3 b 2 5 a 2See Question&Answers more detail:os