Home > Database > Mysql Tutorial > 记录mysql 的group_concat函数用方法_MySQL

记录mysql 的group_concat函数用方法_MySQL

WBOY
Release: 2016-06-01 13:44:59
Original
760 people have browsed it

bitsCN.com

表结构如下: 
id   rod_id  role_name 
1     1      超级管理员 
2     1      管理员 
3     1      系统管理员 
4     2      高级会员 
5     3      普通会员 
6     4      游客 

实现sql 
select role_id,group_concat(role_name) from roles group by role_id; 

这个在oracle10g以下版本中比较难实现,oracle10g中可以用WM_CONCAT函数

作者“yipbxx”
 

bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template