samedi 8 juin 2019

MySQL query return breaks in dataset

My IoT slave devices send incrementally numbered packet_ids to a Raspberry Pi that logs the packets in a mySQL table.

I want to run a script that checks for breaks in the packet_ids per device, returns the device|packet_id after the break representing missed messages.

I know basic querying but the syntax of this function is beyond me. Any help is greatly appreciated.

device_id packet_id
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 9
1 10
2 5
2 6
2 7
2 8
2 10

In the db excerpt, 1|9 & 2|10 would be returned.

Aucun commentaire:

Enregistrer un commentaire