I have an SQLite database with temperature and humidity readings. I would like to get the last reading for each of several sensors. I have the following script which will get me the last temperature reading but I would like the humidity reading from the same row. Perhaps there is a better way to go about this, I am open to suggestions.
SELECT
DISTINCT s.name,
LAST_VALUE(temp) OVER (
PARTITION BY a.id
ORDER by a.insdate asc
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
)as Last
FROM sensors s, acuriteHx a
where a.id in (137,150,156,223,226,9545,14513,15783) and a.id=s.id