rest-vz/sqls.txt
2025-03-07 17:31:35 +01:00

31 lines
1.6 KiB
Plaintext

SELECT COUNT(*) FROM volkszaehler.tobias_aggregate;
SELECT COUNT(*) FROM volkszaehler.data WHERE channel_id = 1 OR channel_id = 4;
SELECT MAX(volkszaehler.tobias_aggregate.timestamp_start), channel_id FROM volkszaehler.tobias_aggregate GROUP BY channel_id;
DELETE FROM volkszaehler.tobias_aggregate;
SELECT * FROM volkszaehler.tobias_aggregate WHERE channel_id=4 AND timestamp_start>=1740697200000 AND timestamp_end<=1740783600000 ORDER BY timestamp_start;
SELECT MIN(timestamp_start), MAX(timestamp_end), SUM(sum_positive), SUM(sum_negative), COUNT(*) FROM volkszaehler.tobias_aggregate
WHERE channel_id=4 AND timestamp_start>=1704063600000 AND timestamp_end<=1735686000000;
SELECT SUM(value) FROM volkszaehler.data WHERE channel_id=4 AND value < 1.0 AND value > 0.0 AND timestamp>=1704063600000 AND timestamp<=1735686000000;
SELECT * FROM volkszaehler.data WHERE channel_id=4 AND timestamp>=1704063600000 AND timestamp<=1735686000000 AND value>0 ORDER BY timestamp;
SELECT timestamp FROM volkszaehler.data WHERE channel_id=4 AND timestamp >= 1740697200000 ORDER BY timestamp
--
SELECT * FROM tobias_aggregate WHERE channel_id=4 ORDER BY timestamp_start;
DELETE FROM volkszaehler.tobias_aggregate
SELECT MIN(timestamp_start), MAX(timestamp_end), SUM(sum_positive), SUM(sum_negative), COUNT(*) FROM volkszaehler.tobias_aggregate
WHERE channel_id=4 AND timestamp_start>=1704063600000 AND timestamp_end<=1735686000000
ALTER TABLE tobias_aggregate MODIFY sum_positive BIGINT;
SELECT (timestamp - 1653030000000) AS TS, value from data where timestamp>=1653030000000 and timestamp<=1653030124133 AND channel_id=4;