----------------------------
如图,表有a,b,c,d四个字段,怎么写sql使得a,b,c三个字段相同时,把d字段的字符串有逗号拼接起来,三条数据变为一条数据?
参考回答:https://bbs.fanruan.com/wenda/question/157692.html
SELECT a,b,c,STRING_AGG(d, ',') AS merged_string
FROM table_name
group by a,b,c;
select a+','+b+','+c+','+d as zd from a