错误 SQL 语句 : select 'QG'+cast(id as varchar) from product LIMIT 0, 30MySQL 返回: You have an error in your SQL syntax near '(id as varchar) from product LIMIT 0, 30' at line 1返回
select 'QG'+convert(varchar,id) from tablename
select concat('QG',id) qid from tablename
真晕了,居然有这么多用+号的。 把auto_increment去掉,然后 update tbname set id=concat('QG',id) 这个是改变表数据的,慎用
错误 SQL 语句 : update product set id=concat('QG',id)MySQL 返回: Duplicate entry '0' for key 1
呵呵!id是int型,怎么能加上字母呢?
this,刚试过:SELECT concat('gp',cast(id as char)) FROM tablename
按要求修改一下,哈哈:SELECT concat('QG',cast(id as char)) FROM tablename
SQL 语句 : select 'QG'+cast(id as varchar) from product LIMIT 0, 30MySQL 返回:
You have an error in your SQL syntax near '(id as varchar) from product LIMIT 0, 30' at line 1返回
把auto_increment去掉,然后
update tbname set id=concat('QG',id)
这个是改变表数据的,慎用
错误
SQL 语句 : update product set id=concat('QG',id)MySQL 返回:
Duplicate entry '0' for key 1