SELECT house.name, point.id, rw.data FROM Unit AS city JOIN Unit AS street ON street.ParentID = city.UnitID JOIN Unit AS house ON house.ParentID = street.UnitID JOIN Points AS point ON point.ID = house.UnitID JOIN Data AS rw ON rw.DevID = point.DevID AND rw.Time BETWEEN '20161209' AND '20161211' WHERE city.id = 1 I get the street, then the house number, and after the id of the device tied to the house. From the device, between dates in 3 days, I get 3 entries of float values.
How to get the difference of values (rw.Value) of 11 and 9 numbers, and put it in rw.data?