Reputation: 323
I learned about the select replace('string','to be replaced','with this')
function, but I'm wondering is there a way I can do something to a whole column, like this
select replace(table.column1,'replace this', 'with this');
Right now, the command is returning Query 1 ERROR: Unknown table 'private_db' in field list
Upvotes: 0
Views: 77
Reputation: 782499
You need a FROM
clause.
SELECT replace(column1, 'replace this', 'with this') AS new_column1
FROM yourTable
This will return all the values in column1
with the replacement made.
Upvotes: 2