Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何用“。”格式化数字 作为千位分隔符,而“,”作为MySql中的小数分隔符?
我正在使用Format类似的功能
Format
SELECT Format(myNumber,2) as myNumberFormatted FROM ...
但返回类型是一个数字,如:
1,000,000.00
相反,我想要
1.000.000,00
在 MySQL 中怎么做?
谢谢
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
指定语言环境。
FORMAT(myNumber, 2, 'de_DE')