36 lines
2.0 KiB
Plaintext
36 lines
2.0 KiB
Plaintext
-- Wie viel wurde maximal pro Tag eingespeist, wenn man 2x so viel Photovoltaik hätte
|
|
SELECT FROM_UNIXTIME(MIN(timestamp_start)/1000) AS Datum, SUM(ABS(LEAST(obtained_energy + produced_energy - injected_energy - 2 * produced_energy, 0)))/3600000 AS mysum FROM tobias_aggregate2 WHERE house_id=1 AND timestamp_start >= 1704067200000 AND timestamp_end <= 1735689600000 GROUP BY FLOOR(timestamp_start / 86400000) ORDER BY mysum DESC;
|
|
|
|
|
|
|
|
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; |