I\'m trying to run a query like what\'s answered here, SQL Selecting multiple sums?
SELECT SUM(CASE WHEN order_date >= \'01/01/09\' THEN quantity ELSE 0
2013 update: BigQuery supports CASE:
SELECT CASE WHEN x=1 THEN 'one' WHEN x=2 THEN 'two' ELSE 'more' END
FROM (SELECT 1 AS x)
'one'
The way to do this in BigQuery is to use the if(test,then,else) function.
For example:
SELECT sum(if (revision_id > 10, num_characters, 0)) FROM [publicdata:samples.wikipedia]
or similar to your second query:
SELECT if (revision_id == 1, 'one', (if (revision_id == 2, 'two', 'more'))) FROM [publicdata:samples.wikipedia] limit 100