1.collect_set
分组组合数组(数组内去重) collect_set
select code ,collect_set(tenant_id) from dim_mkt_event group by code;
2.array_contains
数组中是否包含 ,返回布尔类型
select
code
,array_contains(set_tenant,1211809272448907264)
,!array_contains(set_tenant,1211809272448907264)
from
(
select
code
,collect_set(tenant_id) as set_tenant
from dim_mkt_event
group by
code
) a
3. concat_ws
select concat_ws('|',name,age,sex,grade,telno) from table2;