Reputation: 165
I have a field called "sales" and the source data is piping in a value with a comma (ex: 1,000) instead of 1000 (without commas).
How can I convert this value to a numeric (without commas)?
Thanks in advance!
Upvotes: 2
Views: 717
Reputation: 15905
This should work:
select replace(sales, ',', '')::numeric from tablename;
replace(sales, ',', '')
to remove commas (',') and ::numeric
to convert value to numeric.
Upvotes: 1
Reputation: 1271151
You could remove the comma:
select replace(sales, ',', '')::numeric
Upvotes: 1