Update Postgresql

Asked

Viewed 113 times

1

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

Could I run an update by Postgresql, by changing the cost prices to the prevailing 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

inserir a descrição da imagem aqui

  • If I understand correctly you want to take the value contained in the price attribute practiced and insert in the cost price attribute and then delete the attribute of the price practiced. correct? If this is the case, post an image of the table structure.

1 answer

0

That way*:

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

*make corrections according to your table.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.