mysql中的group_concat()
2008-12-25 21:36
323 查看
mysql> select * from tab1;
+----+------+
| id | c2 |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
| 5 | 2 |
| 6 | 2 |
+----+------+
6 rows in set (0.00 sec)
mysql> select c2,group_concat(id order by id separator ',') from tab1 group by c
2;
+------+--------------------------------------------+
| c2 | group_concat(id order by id separator ',') |
+------+--------------------------------------------+
| 1 | 1,2,3,4 |
| 2 | 5,6 |
+------+--------------------------------------------+
2 rows in set (0.00 sec)
我记得ORACLE也有这样的一个函数 wmsys.wm_concat()
+----+------+
| id | c2 |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
| 5 | 2 |
| 6 | 2 |
+----+------+
6 rows in set (0.00 sec)
mysql> select c2,group_concat(id order by id separator ',') from tab1 group by c
2;
+------+--------------------------------------------+
| c2 | group_concat(id order by id separator ',') |
+------+--------------------------------------------+
| 1 | 1,2,3,4 |
| 2 | 5,6 |
+------+--------------------------------------------+
2 rows in set (0.00 sec)
我记得ORACLE也有这样的一个函数 wmsys.wm_concat()
相关文章推荐
- mysql中GROUP BY结合GROUP_CONCAT的使用
- MSSQL将多行单列变一行一列并用指定分隔符分隔,模拟Mysql中的group_concat
- MySQL中函数CONCAT及GROUP_CONCAT
- mysql GROUP_CONCAT 以及 其逆过程
- mysql 5注入中group_concat的使用
- MySQL中函数CONCAT及GROUP_CONCAT
- MySQL的行转列、列转行、连接字符串 concat、concat_ws、group_concat函数用法
- mysql group_concat()函数陷阱问题
- MySQL的行转列、列转行、连接字符串 concat、concat_ws、group_concat函数用法
- MySQL中函数CONCAT及GROUP_CONCAT
- mysql之使用find_in_set和group_concat组合递归函数时数据不全
- MySQL 使用locate函数对 GROUP_CONCAT 列进行 JOIN 操作
- mysql中的concat函数,concat_ws函数,concat_group函数之间的区别
- mssql的 for xml path 与 mysql中的group_concat类似MSSQL For xml Path
- 浅谈MySQL中group_concat()函数的排序方法
- percona教程:MySQL GROUP_CONCAT的使用
- MySQL中函数CONCAT及GROUP_CONCAT
- MYSQL中group_concat有长度限制!默认1024
- Mysql group_concat函数被截断的问题