Bob
Bob

Reputation: 10775

PostgreSQL insert select multiple column values

I have a table with three columns:

Name Surname NameSuname
Bob  Marley  NULL
John Doe     NULL

I want to insert values from Name and Surname columns into NameSuname column. How can I do that?

Upvotes: 0

Views: 90

Answers (1)

Calipso
Calipso

Reputation: 967

You need to update the coumn instead of inserting

UPDATE MyTable
  SET NameSuname = Name || ' ' || Surname 

Upvotes: 2

Related Questions