Vipul
Vipul

Reputation: 610

concatenate a string for all column values in sql update

I have a component table which has id, query columns. I want to concatenate a string type=bug to the query column for all values. Can it be done using update statement?

udpate dbname.tablename set query=query+"some_string", wiil this work?

Upvotes: 0

Views: 1120

Answers (2)

Awk_
Awk_

Reputation: 58

If i understand correctly, you can do this with CONCAT(value, ' type=bug') at every field like :

UPDATE `col` SET `col1` = CONCAT(col1, ' type=bug'), SET `col2` ...

Upvotes: 1

Rafael L R
Rafael L R

Reputation: 530

SELECT CONCAT(Id,' string') AS 'Column' FROM Table. UPDATE TABLE SET COLUMN = CONCAT(Id, ' string')

OR

SELECT (Id + 'string') AS 'Column' FROM Table. UPDATE TABLE SET COLUMN = (Id + 'String')

Upvotes: 0

Related Questions