user1876234 user1876234 - 5 months ago 8
SQL Question

Replace dot with comma on SELECT

I would like to replace any 'dot' character in my query string, on

SELECT
ing fields from database.

I'll need to modify lots of queries, I'm willing there's a function that will work to all columns on
SELECT
. I mean something like this
SELECT DOT_TO_COMMA(*) FROM...


Right now what I have:

SELECT price, lastprice FROM products


OUTPUT: 22.10, 5.24


EXPECTATION: 22,10, 5,25

Answer
SELECT REPLACE(price, '.', ',') AS price
FROM products;
  • read more about it here

You have to wrap each column you need to replace with the function. Using replace(*) is not possible.