日期:2014-05-18 浏览次数:20501 次
SELECT a.SceneId, COUNT(distinct a.UsersName) AS Expr1 FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersName WHERE (u.UsersSex = '男') GROUP BY a.SceneId
SELECT S.SceneName, COUNT(distinct a.UsersName) AS Expr1 FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersName Inner join SceneInfo AS S on a.SceneId=S.SceneId WHERE (u.UsersSex = '男') GROUP BY S.SceneName
------解决方案--------------------
SELECT SC.SceneName, COUNT(distinct a.UsersName) AS Expr1 FROM ApplyInfo AS a INNER JOIN UsersInfo AS u ON a.UsersName = u.UsersName inner join sceneinfo SC on SC.sceneid =a.sceneid WHERE (u.UsersSex = '男') GROUP BY SC.SceneName