如何在mysql查询中的_ percent _ text中替换百分号

时间:2014-08-13 03:25:02

标签: php

如何在MySQL查询中的_percent_文本中替换百分号?

SELECT REPLACE(dp.desc, "_percent_", "%") AS desc1 FROM tablename 

1 个答案:

答案 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