I will substitute values of a column in table A for values of table B, being conditioned by a column of table C.
When you perform UPDATE, the conditional 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 the UPDATE be done obeying the mentioned case? The above query does not bring the expected result.