cancel
Showing results for 
Search instead for 
Did you mean: 

Get the difference between two values in different recordings.

I have multiple sensors and every value is recorded every 20S in my dB. Each recording has an ID, value, sensor id and timestamp. I would like to find an SQL request that would allow me to get the difference between the values reported by 2 sensors at near similar times. So for instance, for each value of sensor 5, I would like to get the difference with the closest value for sensor 5. Then I would like to also ensure that both values are not too far in time (20s for instance) and return a value only in that case.

Would anyone have pointers or even a syntax to do this? I know influx is made for this stuff, but I know SQL only and don't yet understand nosql design so for now it's mysql.

Thanks in advance for the help!

MaxwellGael
Member
1 REPLY 1

Every week, a couple of sensors fail. It's strange because it's close to the base, yet my farthest sensor has no issues.


https://router-address.com/

https://whatmyagenow.com/
zeno93
Member