Ver originalUPDATE tabla1 SET entradas = T2.StockFROM tabla1 T1INNER JOIN ( SELECT T2.id, T2.entradas - T4.salidas Stock FROM tabla1 T3 INNER JOIN tabla2 T4 ON T3.id = T4.id) T2 ON T1.id = T2.id