I'll preface this question with that I'm extremely new to learning SQL and so much of this is over my head... but I'm trying! haha
Ultimately, what I want is super simple (famous last words), to sum up the top 200 merchants estimated sales values by country. However, the wrinkle I ran into this evening is that the currency that I want to sum, is stored as a string, in various currency types.
Is there a way to convert those currency values to a number, so I can effectively sum those up?
Here's a sample of the query I was hoping to use in BigQuery, when I discovered the string issue and I got blocked:
select sum (estimated_monthly_sales) as top_200_monthly_sales
from (
select merchant_name,
sum (estimated_monthly_sales) as monthly_sales_est
from `storesList`
where country_code = "AT"
group by 1
order by monthly_sales_est DESC
limit 200)
Here's a sample table:
merchant_name | estimated_monthly_sales | country_code |
---|---|---|
A Store | $ 1,450.99 | US |
B Store | EUR €936.97 | AT |
C Store | CZK 2,879.97 Kč | CZ |
D Store | $ 2,631.99 | US |
E Store | EUR €1,234.56 | AT |
F Store | CZK 1,845.97 Kč | CZ |