中野智文のブログ

データ・マエショリストのメモ

BigQuery の standard sql にも ROLLUP はあるよ

背景

上手いこと使うと、全体の合計と、group で指定したそれぞれの合計が同時に取得できる rollup だが、日本語のBQの標準SQLのページには記載がない(2018/03/20現在)

具体的には次のような感じ

f:id:nakano-tomofumi:20180320103122p:plain

解決法

次のように言語の設定を英語にしよう。

f:id:nakano-tomofumi:20180320103336p:plain

すると group by の説明に…

f:id:nakano-tomofumi:20180320103349p:plain