2
I will replace the values of a column in table A by values in table B, being conditioned by a column in table C.
When doing UPDATE, the condition is not being respected and all values are being changed.
UPDATE
tabela_precos_produtos
SET
valor_canal = pg.jan_valor,
valor_partida = pg.dez_valor
FROM
precos_geral pg
JOIN
tabela_precos tp ON cod_tabela = cod_tabela
WHERE
tp.uf = 'SP'
How should UPDATE be done following the mentioned case? The above query does not bring the expected result.