How I can to group continuous data in MySQL table and store its number to an extra column?
For example:
id, n
1 10
2 10
3 10
4 56
5 10
6 10
7 80
8 12
I want to get something like this. Notice that n of 10 is listed twice.
id n cnt
1 10 3
4 56 1
5 10 2
7 80 1
8 12 1
Is that any way to do this without FUNCTION?
You can with use of MySQL Variables