开发者

Concat not work phpmyadmin (mysql)

开发者 https://www.devze.com 2022-12-29 22:38 出处:网络
i want update my row and concat my string but i have an error with thi开发者_开发技巧s query UPDATE FILE SET NOMFIC =\'supp_\'+D_NOMFIC WHERE IdFile = 2

i want update my row and concat my string but i have an error with thi开发者_开发技巧s query

UPDATE FILE SET NOMFIC ='supp_'+D_NOMFIC WHERE IdFile = 2


UPDATE FILE SET NOMFIC = CONCAT('supp_',NOMFIC) WHERE IdFile=2;

See the CONCAT() function within the MySQL documentation here

CONCAT() basically takes as its parameters a list of strings to be concatenated together.


You can't concat with + in MySQL. Use CONCAT('supp_, D_NOMFIC), so it becomes UPDATE FILE SET NOMFIC = CONCAT('supp_, D_NOMFIC) WHERE IdFile = 2

For more info see: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat

You can concat quoted strings like this: SELECT 'a' 'b' 'c' FROM someTable though.


Try this:

UPDATE FILE SET NOMFIC = CONCAT('supp_', D_NOMFIC) WHERE IdFile = 2


Use CONCAT instead:

UPDATE FILE SET NOMFIC =CONCAT('supp_',D_NOMFIC) WHERE IdFile = '2'


Try this:

update table_name set column_name1=CONCAT(column_name2,'something');
0

精彩评论

暂无评论...
验证码 换一张
取 消