mysql使用随机数生成器更新错误
我有下面的查询,它生成一个随机数,然后将xxxx附加到它。 然后我将其更新到该列mysql使用随机数生成器更新错误,mysql,Mysql,我有下面的查询,它生成一个随机数,然后将xxxx附加到它。 然后我将其更新到该列 UPDATE users SET profile_name = concat( "xxxxx" , CONVERT(varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) ) 它抛出了下面的错误 #1064 - You have an error in your SQL syntax; check the manual that corresponds to you
UPDATE users SET profile_name = concat( "xxxxx" , CONVERT(varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) )
它抛出了下面的错误
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) )' at line 1
错误是什么 我认为这是您想要的可执行文件:-
SELECT CONCAT( "xxxxx" , CONVERT(FLOOR( 7 + ( RAND( ) * 9999999 ) ), CHAR ) )
试试这个:
UPDATE users SET profile_name = concat("xxxx", FLOOR(7 + RAND() * 9999999))
CONVERT函数的语法是
CONVERT(值、类型)
。请更正。请看,您可以删除转换功能,只需离开updateuserssetprofile\u name=concat(“xxxxx”,FLOOR(7+(RAND()*999999)))