PostgreSQL Update

0

I have a question, a customer informed that there was an error in the registration of his products, and the employees registered the cost price as the price and vice versa.

Would I have to run an update from PostgreSQL , changing cost prices to price?

In fact it's the opposite, I have to take the Cost price, and insert in the price the column vlpreco is the one that has to be inserted in the column clprecoant

    
asked by anonymous 20.12.2017 / 05:30

1 answer

0

This way *:

update NomeDaTabela as s set valor1= p.valor2, valor2= p.valor1 from NomeDaTabela as p where s.valor2=p.valor2;

* make the corrections according to your table.

    
20.12.2017 / 07:14