BigQuery for Standard SQL中等效的收集集是什么

时间:2019-01-24 18:06:33

标签: google-bigquery

我在下表中尝试为给定的array set找到一个id。我知道collect_set在Hive中可用,但我想知道BigQuery中的等效内容。我正在使用Standard SQL

这是我的查询

with temp as (
select "1" as id, "a" as source_field
union all
select "1" as id, "b" as source_field
union all 
select "1" as id, "b" as source_field
)
select id, string_agg(source_field) as op
from temp
group by id 

这将返回

id   op
1   a,b,b

我需要

id   op
1   a,b

因为我只想要给定id的不同成员

1 个答案:

答案 0 :(得分:2)

您应按照以下示例使用public function hookPaymentReturn() { if (!$this->active) { return; } //this is the variable that I want to populate from the above-mentioned $somePostData found in postProcess() $receipt_display = 'some data'; $this->context->smarty->assign('receipt_display', $receipt_display); return $this->display(__FILE__, 'views/templates/hook/confirmation.tpl'); }

string_agg(distinct source_field)