惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
B
Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
博客园_首页
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
D
Docker
爱范儿
爱范儿
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net

博客园 - 路人甲乙丙丁张三

wsl安装docker后访问办公网故障 idea springboot多环境指定application.properties VIM 零宽度(断言)匹配用法示例 Oracle Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (HikariPool-1) has been closed. 透镜大灯H4线组的作用,是否需要买线组 vim 查看命令模式关键字总览清单 塘下摩托车驾校流程记录 IDEA 运行 Junit 测试用例报 !!! JUnit version 3.8 or later expected 记一次NoClassDefFoundError解决过程 win10 iis ftp用指定的用户名和密码无法登录 oracle merge into clob 无法从套接字获取更多数据 postman使用全局cookie,模拟浏览器保存cookie 写字板打开txt文件显示乱码问题原因 centos7.6挂载windows共享文件 VMware能上外网却不能和宿主机互相ping通的解决办法 jeesite 经常出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL解决思路 使用jeesite org.springframework.beans.NotReadablePropertyException: Invalid property 'tfxqCmsAccount.id' of bean class Ambiguous handler methods mapped for HTTP path The method getContextPath() is undefined for the type ServletContext
mysql 根据某个字段将多条记录的某个字段拼接成一个字段
路人甲乙丙丁张三 · 2016-07-16 · via 博客园 - 路人甲乙丙丁张三

未合并情况

SELECT
a.id,
b.name
AS "role"
FROM
sys_user a
INNER JOIN sys_user_role c ON a.id=c.user_id
INNER JOIN sys_role b ON b.id =c.role_id
WHERE
a.del_flag=0
AND
b.del_flag=0

结果

id                  role

1                   系统管理员
1                   测试角色
2                   系统管理员
2                    测试角色
9                   系统管理员
9                   测试角色
d11828f3dbf148829287aeb637cbf6ec 系统管理员
d11828f3dbf148829287aeb637cbf6ec 测试角色
fe55ff534d23453ab66fda0912f6018d 系统管理员
fe55ff534d23453ab66fda0912f6018d 测试角色

合并情况

SELECT id,GROUP_CONCAT(role) AS "rolelist" FROM
(SELECT
a.id,
b.name
AS "role"
FROM
sys_user a
INNER JOIN sys_user_role c ON a.id=c.user_id
INNER JOIN sys_role b ON b.id =c.role_id
WHERE
a.del_flag=0
AND
b.del_flag=0)d
GROUP BY id

结果

id                       rolelist

1                    测试角色,系统管理员
2                     测试角色,系统管理员
9                     测试角色,系统管理员
d11828f3dbf148829287aeb637cbf6ec 测试角色,系统管理员
fe55ff534d23453ab66fda0912f6018d 测试角色,系统管理员

或者

select a.id,group_concat(b.name) AS rolelist
from sys_user a
inner join sys_user_role c on a.id = c.user_id
inner join sys_role b on b.id = c.role_id

WHERE
a.del_flag=0
AND
b.del_flag=0
group by a.id

结果也一样