Using a CASE statement to change the value of a new BigQuery column based finding one specific entry inside a PARTITION

前端 未结 2 637
孤城傲影
孤城傲影 2021-01-28 23:54

I trying to write some case statements which might change the value of all entries in the call if a particular condition is satisfied INSIDE the partition. Here is the specific

2条回答
  •  遥遥无期
    2021-01-29 00:19

    If you are looking for avoiding joins, you can use an aggregated function with Over. something like:

    Max(If((Your Condition here),Your value here, Null)) Over( Partition By Your_Partition)
    

    the window functions used to had some performance issues that should have been improved recently. My experience with BQ drives me to prefer Jordan's Join suggestion. But hey, its a fun riddle...

提交回复
热议问题