🖥
What to do if you can not write a WHEN CASE statement in BigQuery
problem
The following query can not be used.
SELECT CASE fruit WHEN 'Apple' THEN 'is apple' WHEN 'Orange' THEN 'is orange' ELSE 'none' END AS fruit_kind;
Query Failed Error: searched case expression not supported at:
(Not supported)
Solution
It was a way to "write the object of CASE in duplicate every WHEN line".
SELECT CASE WHEN fruit = 'Apple' THEN 'is apple' WHEN fruit = 'Orange' THEN 'is orange' ELSE 'none'
result:
Row fruit_kind 1 is apple
Supplement
- Information as of October 9, 2015.
Original by
BigQuery で WHEN CASE 文が書けない時の対処法
About
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
公開日時
2019-04-16
Discussion