How to change number comma separation format in mysql from "," to "."
If I have a not fixed length of factorial part of the number.
views:
24answers:
1
+3
A:
Don't do this in mySQL.
Do it on the presentation end, where you output the data.
You can then also take into account possible internationalization settings made by the user (english users getting 1,000
, european users getting 1.000
etc...)
Re your comment: There seems to be no native mySQL function to do this. FORMAT()
can't change the decimal and thousands separators. A replace like this should work:
SELECT REPLACE(CAST(numericfield AS CHAR), ".", ",") AS numericfield_formatted
if anybody has a more elegant solution ... fire away.
Pekka
2010-08-27 09:25:59
I need an export to a csv file. So, I am using only MySql
Dmitry
2010-08-27 09:30:11
@Dmitry I updated my answer.
Pekka
2010-08-27 09:33:05