I’m trying to convert 60% -> 60
of all the columns in a table. I have tried this, but it does not work because % is an SQL operator.
UPDATE host_info set host_response_rate = replace(host_response_rate,'%', '');
But I get all the values to be NULL…
I’m using postgresql
Advertisement
Answer
you can use this function, this take out the last n characters of a string. if you use 1, it will take out the last digit.
SELECT RIGHT(host_response_rate, 1) FROM ...