如何在sql的某个列中预先添加某个值

时间:2015-02-02 09:57:06

标签: mysql sql

如何在sql的某个列中预先添加某个值。我想在foo.value上说“100_”前缀并更新。我应该怎么做呢?

create table foo (id, value, ...)

insert into foo (1, 1);
insert into foo (2, 1);
insert into foo (3, 3);
insert into foo (4, 2);
insert into foo (5, 3);
insert into foo (6, 6);

1 个答案:

答案 0 :(得分:2)

value列必须为varchar数据类型。

UPDATE Foo SET Value = '100_' + Value