I want to read a table with a SQL query in MySQL, which gives me the consecutive blocks of a row. The query may only last a maximum of 120 seconds, which I already exceed with my queries, I also can't manage to count consecutive numbers at all.
So if for example the table would look like this:
ID | additionalInformation | Number | anotherInformation |
---|---|---|---|
1 | ... | 600 | ... |
2 | ... | 601 | ... |
3 | ... | 602 | ... |
4 | ... | 604 | ... |
5 | ... | 606 | ... |
6 | ... | 607 | ... |
7 | ... | 609 | ... |
Should the query output the following to me:
count | amount |
---|---|
2 | 1 |
1 | 2 |
1 | 3 |
I have already tried procedures and subselect and also selects in Where, but nothing works for days. I don't know what to try next... Please help!