admin所属角色组字段内容(id)为:1
admin角色组对应的角色字段内容(id)为:1,2,3,5,6,7,8,9,10,11,12
select
s.*,r.*
from
(select
e.*,g.roles
from employee e
inner join roleGroup g
on e.rolegroupid=g.id
where
e.account='admin'
)s,
role r
where ','+s.roles+',' like '%,'+cast(r.id as varchar(10))+',%'
查询字段简化后的显示效果图: