[英]How to pivot/merge rows based on condition in BigQuery?
I have a table that looks like this:我有一个看起来像这样的表:
record![]() |
name1![]() |
name2![]() |
to_merge![]() |
value1![]() |
value2![]() |
---|---|---|---|---|---|
1 ![]() |
STEVE![]() |
null ![]() |
false![]() |
30 ![]() |
null ![]() |
2 ![]() |
JOHN![]() |
null ![]() |
true![]() |
43 ![]() |
null ![]() |
3 ![]() |
null ![]() |
LAURA![]() |
true![]() |
null ![]() |
66 ![]() |
4 ![]() |
JEN![]() |
null ![]() |
false![]() |
18 ![]() |
null ![]() |
I want this to be the output:我希望这是 output:
record![]() |
name1![]() |
name2![]() |
value1![]() |
value2![]() |
---|---|---|---|---|
1 ![]() |
STEVE![]() |
null ![]() |
30 ![]() |
null ![]() |
2 ![]() |
JOHN![]() |
LAURA![]() |
43 ![]() |
66 ![]() |
3 ![]() |
JEN![]() |
null ![]() |
18 ![]() |
null ![]() |
This means I want to merge the rows with a TRUE value in the to_merge field.这意味着我想在 to_merge 字段中合并具有 TRUE 值的行。 Any help is much appreciated!
任何帮助深表感谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.