tested running for a month

This commit is contained in:
Radek
2025-07-24 12:55:14 +01:00
parent 7284b925a5
commit d47e91bcd8
6 changed files with 217 additions and 0 deletions

12
get_latest_from_db.txt Normal file
View File

@@ -0,0 +1,12 @@
# Retrieve the last value for building_total
sqlite3 power_data.db "SELECT * FROM building_totals ORDER BY timestamp DESC LIMIT 1;"
# Retrieve the last value for each individual record in room_breakdown
sqlite3 power_data.db "
SELECT r1.*
FROM room_breakdown r1
INNER JOIN (
SELECT room_number, MAX(timestamp) AS max_timestamp
FROM room_breakdown
GROUP BY room_number
) r2 ON r1.room_number = r2.room_number AND r1.timestamp = r2.max_timestamp;"