Group consecutive records with the same value

0

I am working with tables that receive data every 5 seconds. Many times the same value is received for quite some time. My idea is to only show the records when they change. This is the example:

If you see the image, there are three groups of consecutive records with the same value. My idea is to make a query that only returns one of them, the first of the group, that is, the one of the initial date.

It is not worth a simple DISTINCT with GROUP BY, since registers 1, 2, 10, 11 and 12 have the same value, and with that all disappear and only the first one shows. I want you to group 1 with 2, 3 with 4, and 10 with 11 and 12.

I thought of a stored procedure, but I do not know how to do it.

Can you think of something? Work with MySQL Workbench.

Thanks !!

    
asked by Maribel Gtx 08.02.2018 в 20:00
source

0 answers