Monday, 13 October 2014

MySQL: Format column number to currency

I have some thing like this as result profit=25000000000. What i want is some like this profit=25,000,000,000, is there some way by which we can do it in MYSQL?

Solution:
SELECT FORMAT(total_profit, 2) AS profit FROM sales_profits




----------------------------------------------------------------------------------------

Things in MySQL aren't quite so easy. But we can still format the number to get two decimal places, and prepend a "$":
 

select date(created_at), concat("$", format(sum(price), 2)) from orders group by 1




0 comments:

Post a Comment