Reputation: 105
I want to add mark_
to the beginning of the data contained in the column SYSLOCE2
.
How do I get this done automatically with query?
|---------------------|------------------| |---------------------|------------------|
| ID | SYSLOCE2 | | ID | SYSLOCE2 |
|---------------------|------------------| |---------------------|------------------|
| 1 | sample | | 1 | mark_sample|
|---------------------|------------------| |---------------------|------------------|
| 2 | people | | 2 | mark_people|
|---------------------|------------------| => |---------------------|------------------|
| 3 | hello | | 3 | mark_hello |
|---------------------|------------------| |---------------------|------------------|
| 4 | world | | 4 | mark_world |
|---------------------|------------------| |---------------------|------------------|
Upvotes: 0
Views: 35
Reputation: 37472
Use concat()
to concatenate strings.
UPDATE elbat
SET sysloce2 = concat('mark_', sysloce2);
Upvotes: 1
Reputation: 1269563
You can use update
:
update t
set sysloce2 = concat('mark_', sysloce2);
In the more recent versions of MySQL, you could use a computed column instead.
Upvotes: 2