1,將分組之後的string字符合並起來。如下所示:
select distinct item_id,array_join(array_agg(distinct name),',')
from shmods.mysql_shop_item_cids a
inner join shmods.mysql_s__categories b
on cid=b.id
where a.item_id = '8299155472'
group by item_id
array_agg()將分組之後的數據合併成list; array_join(,',')將list數據合併起來並用','合併成字符串;
參考地址:https://help.aliyun.com/document_detail/64035.html?spm=a2c4g.11186623.3.3.a7444bdadYqCz9