Update table field with information from another column

Asked

Viewed 49 times

1

How to do an update that recovers data from one column and plays in another column? For example

Sales

IdVenda | dataVenda  | dataPgto
1       | 2017-08-21 | 
2       | 2017-08-21 |

Want to update the dataPgto with the dataVenda information? PS: this sale would be made with credit card.

  • You need to give some more information, such as table names and structures.

  • @Inhares is from the same brother table :)

2 answers

1

1


Being the same table you won’t need to Join or something like that; just know the update condition, in case the id of the item that will be updated (idVendaEfetuada):

UPDATE tabela_vendas SET dataPgto = dataVenda WHERE IdVenda = idVendaEfetuada

Browser other questions tagged

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