idi0tech
(gav)
1
Hi All
I’d like to know what time i switched off the light in my room every night for the last 2 months. Can any one write an SQL query please?.
I’ve so far not had time to learn any SQL (but i will) and i could really use this info.
Table: item17
Database: openhab
The columns are TIME and VALUE
e.g.
2006_10_25 23:45:06 and OFF
Many thanks
Rob_Pope
(Rob Pope)
2
Hi Gav, give this a go and let me know the output. I spend most of my time in MS SQL, but this should be close to what you need.
EDIT: It was listing all events, so I’ve updated it to just include the OFF events
SELECT TIME
FROM item17
WHERE TIME > NOW() - INTERVAL 2 MONTH
AND VALUE = 'OFF’
ORDER BY TIME DESC;