1

I have a query of MySQL like this-

SELECT avg('total_cost') FROM 'employee'

And then I am getting output like this-

1254589687.26587952

But I like to have a output like this-

1,25,45,89,687.26

So, a comma separator should be added and number should be rounded.

Is there any way in MySQL?

Thanks for helping.

Abrar Jahin
  • 113
  • 1
  • 5
  • The manual is your friend: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_format – tombom Sep 17 '15 at 06:03

1 Answers1

4
+----------------------------------+
| format(123456789.26, 2, 'ta_in') |
+----------------------------------+
| 12,34,56,789.26                  |
+----------------------------------+

http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_format
http://dev.mysql.com/doc/refman/5.6/en/locale-support.html -- locales

Rick James
  • 66,863
  • 4
  • 38
  • 92