Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 更新500+;字段记录包括一个增量值+;属性值_Mysql_Sql - Fatal编程技术网

Mysql 更新500+;字段记录包括一个增量值+;属性值

Mysql 更新500+;字段记录包括一个增量值+;属性值,mysql,sql,Mysql,Sql,我希望在我的mysql数据库中更新500多条记录,这样字段将是$incremental\u value+db\u user\u first\u name+@some\u static\u text的值组合。预期结果的一个例子: 一,_firstname@staticstring.com, 2_george@staticstring.com, 3_johnny@staticstring.com等等 我一直在使用下面的一些方法,但这自然不起作用(为了更好的澄清而进行了修改) MySQL中字符串连接的

我希望在我的mysql数据库中更新500多条记录,这样字段将是
$incremental\u value+db\u user\u first\u name+@some\u static\u text
的值组合。预期结果的一个例子:

一,_firstname@staticstring.com, 2_george@staticstring.com, 3_johnny@staticstring.com等等

我一直在使用下面的一些方法,但这自然不起作用(为了更好的澄清而进行了修改)


MySQL中字符串连接的正确语法是
concat()
函数:

UPDATE user cross join
       (select @i = VALUETOSTART) var
    SET email = concat(@i := @i + 1, '_', user.first_name, '@staticstring.com')
    WHERE email = 'empty@empty.com';
UPDATE user cross join
       (select @i = VALUETOSTART) var
    SET email = concat(@i := @i + 1, '_', user.first_name, '@staticstring.com')
    WHERE email = 'empty@empty.com';