以下是我想将余额(l.slsprice)转换为美元符号$的问题。我怎么这样?
select
s.ordnbr,
s.ordnbr+l.lineref as copy,
(l.slsprice*(s.qtyord-s.qtycloseship)) as balance
from CAL.DBO.opssosched s (nolock)
join CAL.DBO.opssoline l (nolock) on s.ordnbr=l.ordnbr
我要找的结果应该是:
Balance
$6.77
$5
$42
答案 0 :(得分:2)
使用sql-server 2012 +的格式
https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql
format (<field>,'C')
Select format(23.00,'$#,##0.##') -- no cents as per comment