Julius Tan
Julius Tan

Reputation: 3

PostgreSQL UPDATE "insert" infront of existing data

UPDATE table  
SET column = **`insert in front of original data`**  
WHERE condition

Is it possible to insert data in front or at the end?
Or it has to be rewritten all over again?

Upvotes: 0

Views: 60

Answers (1)

Dan
Dan

Reputation: 10680

If I understand you correctly, column is a column containing string data, and you want to prepend text in front of the current value of the column, for each record satisfying the condition?

In that case, just do the following:

UPDATE table
SET column = 'my prepended text' || column
WHERE condition

Upvotes: 3

Related Questions