Merge consecutive matching rows in Mysql

Viewed 26

I have a table in the below format containing consecutive/non-consecutive matching values of student column. I'm trying to merge the rows having only consecutive matching rows.

Table containing consecutive matching values

I'm expecting the output according to the below table:

Expected Output

There are many similar questions already posted in StackOverflow but almost all responses are using ROW_NUMBER and WITH functions to achieve the output and I cannot use those functions because my MySQL version is 5.7 (cannot upgrade since the same version is being used in client instances).

Here I'm presenting the data in dbfiddle https://dbfiddle.uk/dE8DLKCM So, please help me here. Thanks in advance!

0 Answers
Related