Comando Update

#102745
Avatar de ithigvoithigvo
Participante

Tenta assim:
update tabelaA a
set a.quant = (
select b.quant
from tabelaB b
where a.acod = b.bcod
and a.afilial = b.bfilial
and a.aquant != b.bquant
)
where exists (
select 1
from tabelaB b
where a.acod = b.bcod
and a.afilial = b.bfilial
and a.aquant != b.bquant
)

Obs.: Estou chutando que cod e filial são chaves nas duas tabelas…

plugins premium WordPress