update energylog set value=(a.value+c.value)/2
from energylog as a, energylog as c
where a.idvariable=energylog.idvariable and energylog.idvariable=c.idvariable and a.tstamp='2015-03-05 10:00:00' and c.tstamp='2015-03-06 18:00:00'
and energylog.tstamp='2015-03-06 00:00:00' ;