admin管理员组

文章数量:1648338

concat_ws(合并时的分隔符,合并字段1,字段2。。。)

collect_set(字段):根据某个字段分组后,把分在一组的数据合并在一起,默认分隔符','


eg:

select jzad,os_type,concat_ws(',',collect_set(host))
from
    (select  jzad,os_type,host,count(*),row_number() over(partition by jzad,os_type order by cast(count(*) as int) desc) rank
     from fengshang_1387ad_top10host_zqm group by jzad,os_type,host
    ) a where rank<=10
group by jzad,os_type

本文标签: sqlconcatwscollectset