SQL Write Alias to permanent column?

I would like to write the result of this SELECT to a permanent column, instead of a alias. Using MySQL.

SELECT Machine_1_AccProduction,
     Machine_1_AccProduction - coalesce(lag(Machine_1_AccProduction) OVER (order by Time_Stamp), 0) AS diff
from dobbelttapper_1.dobbelttapper_1_accproduction;

I have tried to use a Update statement, but get the error “Operand should contain 1 column”.

UPDATE dobbelttapper_1.dobbelttapper_1_accproduction
SET diff = 
             (SELECT Machine_1_AccProduction,
     Machine_1_AccProduction - coalesce(lag(Machine_1_AccProduction) OVER (order by Time_Stamp), 0) AS diff
FROM dobbelttapper_1.dobbelttapper_1_accproduction);

From Stu´s comment I reduced the Query to this:

UPDATE dobbelttapper_1.dobbelttapper_1_accproduction
SET diff = 
(SELECT Machine_1_AccProduction - coalesce(lag(Machine_1_AccProduction) OVER (order by Time_Stamp), 0));

Now the update works fine, but the result is just a repeat of Machine_1_AccProduction?

This is the result I get:

      Time_Stamp      |Machine_1_AccProduction|  diff
'2021-04-11 20:40:48', '130859',                '130859'
'2021-04-11 20:40:53', '130859',                '130859'
'2021-04-11 20:40:58', '130862',                '130862'
'2021-04-11 20:41:03', '130864',                '130864'
'2021-04-11 20:41:08', '130865',                '130865'
'2021-04-11 20:41:13', '130867',                '130867'
'2021-04-11 20:41:18', '130870',                '130870'

This is what I would like to get:

      Time_Stamp      |Machine_1_AccProduction|  diff
'2021-04-11 20:40:48', '130859',                '0'
'2021-04-11 20:40:53', '130859',                '0'
'2021-04-11 20:40:58', '130862',                '3'
'2021-04-11 20:41:03', '130864',                '2'
'2021-04-11 20:41:08', '130865',                '1'
'2021-04-11 20:41:13', '130867',                '2'
'2021-04-11 20:41:18', '130870',                '3'

Answer

Using LAG() in an UPDATE is quite tricky in MySQL. Basically, it requires running the query and then joining back on a primary key or unique key. Let me assume that time stamp is unique:

UPDATE dobbelttapper_1.dobbelttapper_1_accproduction ap JOIN
       (SELECT ap2.*,
               LAG(ap2.Machine_1_AccProduction, 1, 0) OVER (ORDER BY Time_Stamp) as prev_Machine_1_AccProduction
        FROM dobbelttapper_1.dobbelttapper_1_accproduction ap2
       ) ap2
       ON ap.time_stamp = ap2.time_stamp
    SET ap.diff = ap.Machine_1_AccProduction - ap2.prev_Machine_1_AccProduction;