这句SQL语句怎么改才能显示名称
SELECT a.SceneId, COUNT(distinct a.UsersName) AS Expr1FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersNameWHERE (u.UsersSex = '男')GROUP BY a.SceneId
SELECT S.SceneName, COUNT(distinct a.UsersName) AS Expr1FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersName Inner join SceneInfo AS S on a.SceneId=S.SceneIdWHERE (u.UsersSex = '男')GROUP BY S.SceneName
[解决办法]
SELECT SC.SceneName, COUNT(distinct a.UsersName) AS Expr1FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersNameinner join sceneinfo SC on SC.sceneid =a.sceneidWHERE (u.UsersSex = '男')GROUP BY SC.SceneName