1. 查询一个角色下面有多少用户
select * from SystemUser a join systemuserroles b on a.SystemUserId=b.SystemUserId join Role c on b.RoleId=c.RoleId where c.Name=‘System Administrator‘ and a.IsDisabled=0
select * from SystemUser a join systemuserroles b
on a.SystemUserId=b.SystemUserId
join Role c
on b.RoleId=c.RoleId
where c.Name=‘System Administrator‘
and a.IsDisabled=0
CRM 常用SQL 脚本
原文:http://www.cnblogs.com/fengwenit/p/4098360.html