如何在MySQL查询中的_percent_文本中替换百分号?
SELECT REPLACE(dp.desc, "_percent_", "%") AS desc1 FROM tablename
答案 0 :(得分:1)
关闭,你只需要反转参数:
select REPLACE(dp.desc, "%", "_percent_") as desc1 from tablename;
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace