这是我的语句:select count(id),group_concat(name) from ab 找出的结果里含有太多的逗号了,怎么去掉它啊? 理想的结果为: count(id),group_concat(name) 11 aaa,ddd,ggg,fff,ggg,,aaa
------解决方案-------------------- 有name是空看来
select count(id),group_concat(name) from ab where name is not null
------解决方案--------------------
SQL code
select count(*), substring_index(GROUP_CONCAT(name order by name desc),',,',1) from ab;
------解决方案-------------------- select count(id),group_concat(if(name is null or name='','',concat(name,',')) SEPARATOR '') from ab
------解决方案-------------------- +1