0

我有这个查询:

select a.Nm,sum(NoInvoAb * CstPr) as 'kostnadRadLev_intäckt'
from dbo.ProdTr pt
inner join dbo.Actor a on a.CustNo = pt.CustNo
where a.CustNo > 0 and pt.TrDt like '2012%'
group by a.Nm 

结果的第一行:

Cykelmagasinet AB 27865867.000000

但是,我想将浮点数的格式更改为更易于阅读的格式:27 865 867.000000 或 27.865.867,00000。

4

1 回答 1

2

采用:

convert(varchar,cast(sum(NoInvoAb * CstPr) as money),-1)

例如:

declare @aa int

set @aa =123123123
Select convert(varchar,cast(@aa as money),-1) as ColumnName

输出:

123,123,123.00
于 2013-03-07T13:54:05.273 回答