Raised this question before but no answer found
I have one table (table1) with energy data updated every 5 min I am using a trigger to calculate day values on every update and fill another table dayvalues(table2). dayvalues starting on zero every day.
Because I have errors of missing data in the past I want to recreate the table dayvalues with the corrected data in table 1.
This is probably a one time action.
Can anybody help how to do this?
Following the trigger used: the trigger contents is and initiated after table 1 update:
BEGIN SELECT max(ElectraHighP1 + ElectraLowP1) - min(ElectraHighP1 + ElectraLowP1) FROM data_rr WHERE DATE (FROM_UNIXTIME(timestamp)) = curdate() INTO @var1; SELECT max(SolarHighP1 + SolarLowP1) - min(SolarHighP1 + SolarLowP1) FROM data_rr WHERE DATE(FROM_UNIXTIME(timestamp)) = curdate() INTO @var2; SELECT max(GasConsumedTotalP1) - min(GasConsumedTotalP1) FROM data_rr WHERE DATE(FROM_UNIXTIME(timestamp)) = curdate() INTO @var3; INSERT INTO DayData (ElectraUsedToday, SolarDeliveryToday, GasConsumedToday ) VALUES (@var1, @var2,@var3); END
Calculates the dayvalues of energy tables.
Aucun commentaire:
Enregistrer un commentaire