I would like to replace a value if the date/time for a row in table is the same for the one he try to insert. If the time/date doesn't exist in the table then insert it.
If you se the picture. The value nr 2 to the end has the same time as the first value. Then it should replace the first one because they have the same time. Not get added last to the list. If the time doesn't exist, then it can be added.
I have tried with REPLACE and ON DUPLICATE KEY UPDATE, but I cant get it to work...
"INSERT INTO flowAvarageValuesDays (time, value) VALUES (%s, %s) ON DUPLICATE KEY UPDATE avarageFlowValueDays=%s", (time,value,value)
and
"REPLACE INTO flowAvarageValuesDays (time, value) VALUES (%s, %s)",
(time, value)