I'm trying to perform an update through this select, where I see the different data from the pen_cadastro table, but when trying to perform an update, it presents errors:
[MYSQL]
UPDATE:
begin transaction
UPDATE pen_cadastro as CADAS
left OUTER JOIN novosusuarios
ON novosusuarios.id <> CADAS.id
set
CADAS.id = novosusuarios.id
group by novosusuarios.id
SELECT (This is working):
SELECT novosusuarios.*
FROM pen_cadastro
left OUTER JOIN novosusuarios
ON novosusuarios.id <> pen_cadastro.id
group by novosusuarios.id
That is, I need to update according to the ID difference from one table to another, if there are no new UUs in the pen_cadastro table then it will insert the values in the set fields that I point to.