Alex Rivera | Logout

Add text to a field with sql query

Asked 2011-02-24T16:12:12.510
27

I have a field in the mysql database and I would like to insert text in front of all the values in that field.

I would like to add "F21 - " So the field would be "F21 - product name" instead of "product name"

I need a simple sql query

any ideas?

Edit
Report

1 Answer

65

Use CONCAT. Something like this:

UPDATE mytable SET myfield = CONCAT('f21 -', myfield)
answered 2011-02-24T16:18:58.330

Your Answer