how to format number with "." as thousand separator, and "," as decimal separator in MySql?
如何用“。”格式化数字。作为千位分隔符,和“,”作为MySql中的小数分隔符?
I'm using Format
function like
我正在使用Format函数
SELECT Format(myNumber,2) as myNumberFormatted FROM ...
SELECT Format(myNumber,2)as myNumberFormatted FROM ...
But return type is a number like:
但是返回类型是一个数字:
1,000,000.00
instead i want
相反,我想要
1.000.000,00
How to do in MySQL ?
在MySQL中怎么办?
Thanks
2 个解决方案
#1
16
MySQL>=5.5:
SELECT FORMAT(10000000.5, 2, 'de_DE') AS format
MySQL<5.5:
SELECT REPLACE(REPLACE(REPLACE(FORMAT(10000000.5,2), ',', ':'), '.', ','), ':', '.') AS format
#1
16
MySQL>=5.5:
SELECT FORMAT(10000000.5, 2, 'de_DE') AS format
MySQL<5.5:
SELECT REPLACE(REPLACE(REPLACE(FORMAT(10000000.5,2), ',', ':'), '.', ','), ':', '.') AS format