I have an update query that calculates a TIMEDIFF on a large number of DATETIME records:
UPDATE eventlog SET downtime = TIMEDIFF(up_stamp,down_stamp);
This works, but I need to set this TIMEDIFF value to another column as well as downtime. Something like this (doesn't work):
UPDATE eventlog SET downtime, downtime_adj = TIMEDIFF(up_stamp,down_stamp);
I know I can combine them like this:
UPDATE eventlog SET downtime = TIMEDIFF(up_stamp,down_stamp), downtime_adj = TIMEDIFF(up_stamp,down_stamp);
But this will recalculate the same time diff 2x as many times as needed. What's the most efficient way to do this?