mysql 的 group_concat() 函数要mysql4.0版本上才可以使用的;
效果 连接字段的;
可以喝group by 联合使用,达到去除重复的效果(这里的说法有点不大正确吧!);
还是上图,比较容易理解些吧:
表结果:
1:select name, group_concat(id) from test1 group by name;
2:select count(name),group_concat(id,'-',name) as f from test1 group by name;
就这,自己测试下巴,重在灵活使用和理解!