Reputation: 87
Hi I am trying to find total revenue earned by cabbies from this data set on google big query here but sum(total_amount) doesn't seem to work. It says
Error: Field total_amount is of type STRING which is not supported for SUM
even though it is defined as numeric data type by default. I did some casting things but then the sum says 0.
I don't seem to find why.
Things I tried:
INTEGER
in SUM like SUM(INTEGER(total_amount))
returned 0.INTEGER
using CAST type returned 0.Here is my query:
Select sum(total_amount) from
[bigquery-public-data:new_york_taxi_trips.tlc_yellow_trips_2018]
What am I missing here?
Upvotes: 1
Views: 1927
Reputation: 173046
NUMERIC data type in Legacy SQL has limited support
So, instead try running your query in BigQuery Standard SQL as in below example
#standardSQL
SELECT SUM(total_amount)
FROM `bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2018`
with result
Row f0_
1 1837861124.95
Upvotes: 2