我有可查询物流成本的表。
您可以在ORDER BY
表中找到here:
要查询Costs_Outbound,我使用以下SQL:
sqlfiddle
到目前为止,所有这些都工作正常。
现在,我想将千位分隔符从SELECT country,
FORMAT(sum(Costs_Outbound), 2) as Costs_Outbound
FROM Logistics
GROUP BY country WITH ROLLUP
更改为","
。
因此,我尝试以某种方式使用解决方案here:
"."
但是,到目前为止,我无法使其正常运行。
您是否知道我的代码中有错误?
答案 0 :(得分:1)
使用此功能FORMAT(number,2 ,'de_DE' )
SELECT country,
FORMAT(sum(Costs_Outbound), 2 ,'de_DE') Costs_Outbound
FROM Logistics
GROUP BY country WITH ROLLUP
答案 1 :(得分:0)
尝试一下:只需将双引号替换为单引号
SELECT country,
REPLACE(FORMAT(sum(Costs_Outbound), 2),',','.') as Costs_Outbound
FROM Logistics
GROUP BY country WITH ROLLUP