REPLACE函数,但包含整列-MySQL



我了解了select replace('string','to be replaced','with this')函数,但我想知道有没有一种方法可以对整个列做些什么,比如这个

select replace(table.column1,'replace this', 'with this');

现在,命令返回Query 1 ERROR: Unknown table 'private_db' in field list

您需要一个FROM子句。

SELECT replace(column1, 'replace this', 'with this') AS new_column1
FROM yourTable

这将返回column1中的所有值,并进行替换。

最新更新