mysql通过group_concat()函数将同一组的值连接起来显示
语法代码如下:
- mysql> select group_concat(stuname),stusex,avg(math) from stu group by stusex;
- +-------------------------------------+--------+-----------+
- | group_concat(stuname) | stusex | avg(math) |
- +-------------------------------------+--------+-----------+
- | 李斯文,诸葛丽丽,梅超风,Tabm | 女 | 70.5000 |
- | 张秋丽,李文才,欧阳俊雄,争青小子,Tom | 男 | 77.2500 |
- +-------------------------------------+--------+-----------+
- 2 rows in set (0.00 sec)
复制代码
|