多对多表联合查询重复问题

用户和角色表多对多关系

 

select a.*,GROUP_CONCAT(c.id) as roles from tb_users a,tb_users_roles b,tb_roles c where a.id=b.user_id and b.role_id=c.id and b.role_id in (1,40) group by a.id

 

posted @ 2021-11-05 19:03  醒日是归时  阅读(66)  评论(0编辑  收藏  举报