使用replace()
和cast()
替换逗号并将其转换为十进制
select pulau, cast(replace(populasi,',','') as decimal(16,8)), cast(replace(luas,',','') as decimal(16,8))
from tablename
你需要从数字中删除.
s,并用,
s替换.
s,然后你就可以SUM
了。尝试这样的事情:
SELECT pulau,
SUM(REPLACE(REPLACE(populasi, '.', ''), ',', '.')) AS populasi,
SUM(REPLACE(REPLACE(luas, '.', ''), ',', '.')) AS luas
FROM yourtable
GROUP BY pulau