Can anyone help me format my dollars data into millions of dollars for SQL Server?
3,000,000
--> $3M
I have this but it's not working
SELECT '$' + SUM(Sales_Information.Sales_in_Dollars / 1000000)
AS [Sales in Millions]
Doing this gives me #Error
format(SUM(Sales_Information.Sales_in_Dollars / 1000000)
4条答案
按热度按时间ncecgwcz1#
The
FORMAT
function has a way of trimming the thousandseach comma reduces the displayed value by 1000
e.g.
(note that I had to use decimals to show 3 million in Billions)
Output:
$0.003B
$3M
$3000K
kxxlusnw2#
试试这个...
zujrkrfu3#
用1000000除你的货币,然后在它的后面加上一个“M”
ipakzgxi4#
只需根据您的要求进行一些编辑: