Reputation: 83
I am looking for aggregate function (sum/avg) per table from the below like query.
SELECT sum(qty) FROM TABLE_QUERY([black-resource-174911:owner],'table_id CONTAINS "sales2017"') where category='shoes'
I am expecting:
100 sales2017W1 200 sales2017W2 250 sales2017W3
Is there any such option in BigQuery? Appreciate help.
Upvotes: 0
Views: 133
Reputation: 173046
Below is for BigQuery Standard SQL
#standardSQL
SELECT SUM(qty) AS sum, _TABLE_SUFFIX AS table
FROM `black-resource-174911.owner.sales2017*`
WHERE category = 'shoes'
GROUP BY table
Upvotes: 2