我需要帮助解决标题中的问题。我已经尝试了很多不同的东西来使这个查询起作用,但我无法做到这一点。这是我的一次尝试:
SELECT r.RoleName, COUNT(u.UserID) AS NumberOfUsers
FROM Roles r INNER JOIN UserRoles u ON u.UserRoleID = r.RoleID
WHERE r.RoleName ='Administators'
GROUP BY r.RoleName;
提前致谢!
答案 0 :(得分:1)
您是否尝试更改尝试匹配表格的ID?
SELECT r.RoleName, COUNT(u.UserID) AS NumberOfUsers
FROM Roles r
INNER JOIN UserRoles u
ON r.RoleID = u.RoleID
WHERE r.RoleName ='Administators'
GROUP BY r.RoleName;
如果这不起作用,运行此查询时会得到什么输出?