Yassine Karouach
Yassine Karouach

Reputation: 11

I want to add a column content to another column in same table

I want to know if it's possible to concatenate two columns in the second column by a query.

Example:

Reference | Description
ref1      | Des1 
ref2      | Des2 
ref3      | Des3 

Result:

Reference | Description
ref1      | Des1 ref1 
ref2      | Des2 ref2 
ref3      | Des3 ref3 

Upvotes: 1

Views: 99

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269563

The function concat_ws() does what you want:

select t.*, concat_ws(' ', reference, description)
from t;

You can incorporate this into an update or computed column.

Upvotes: 2

Related Questions