简体   繁体   English

如何用“。”格式化数字作为千位分隔符,“,”作为小数分隔符?

[英]How to format number with “.” as thousand separator, and “,” as decimal separator?

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 谢谢

MySQL>=5.5: 的MySQL> = 5.5:

SELECT FORMAT(10000000.5, 2, 'de_DE') AS format

MySQL<5.5: MySQL的<5.5:

SELECT REPLACE(REPLACE(REPLACE(FORMAT(10000000.5,2), ',', ':'), '.', ','), ':', '.') AS format

specify locale. 指定区域设置。

FORMAT(myNumber, 2, 'de_DE')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM