Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql select int as currency or convert int to currency format?

Tags:

mysql

People also ask

How to convert currency in MySQL?

Select int as currency or convert int to currency format in MySql? To convert int to current format, use CONCAT() with FORMAT() function from MySQL.

How do I add a currency symbol in SQL?

you need to cast it because you are concatenating a string into a decimal data type. If you are working on it on the application level, you can add extra column which is not processed, ex. SELECT PayerDate, '$' + CAST(PaymentAmount AS VARCHAR(15)) StrPaymentAmount, PaymentAmount FROM Payments .


FORMAT() function: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_format

SELECT CONCAT('$', FORMAT(val, 2)) ... ;