Replace the semicolon with SELECT

I would like to replace any dot character in my query string, in SELECTthe input area from the database.

I will need to change a lot of queries, I want there to be a function that will work with all columns on SELECT. I mean something like thisSELECT DOT_TO_COMMA(*) FROM...

Now I have:

SELECT price, lastprice FROM products

OUTPUT: 22.10, 5.24

EXPECTATION: 22,10, 5,25

+5
source share
3 answers
SELECT REPLACE(price, '.', ',') AS price
FROM products;

You have to wrap each column that you need to replace with a function. Use is replace(*)not possible.

+19
source

try it...

works

SELECT REPLACE(price,'.',',') AS price, REPLACE(lastprice,'.',',') AS lastprice FROM products
0
source

.

SELECT FORMAT (price,0). -

check out http://www.mysqltutorial.org/mysql-format-function/

0
source

Source: https://habr.com/ru/post/1543373/


All Articles