In query the goal is to update the product unit, with a subquery that retrieves the current drive from the database and subtracts by checking by code.
UPDATE loja.produto SET UNIDADE = (SELECT (SELECT UNIDADE FROM loja.produto WHERE CODIGO = '212212121') - 1 ) WHERE CODIGO = '212212121';
I have the following error:
0 100 13:54:14 UPDATE PRODUCT SET UNIT = (SELECT (SELECT UNIT FROM store.product WHERE CODE = '212212121') - 1) WHERE CODE = '212212121' Error Code: 1093. You can not specify target table 'PRODUCT' for update in FROM clause 0.000 sec