日期:2014-05-18 浏览次数:20378 次
select b.SceneId, 男用户人数=sum(case when a.UsersSex='男' then 1 else 0 end), 女用户人数=sum(case when a.UsersSex='女' then 1 else 0 end) from (select distinct SceneId,username from applyinfo) b join usersinfo a on a.a.username=b.username group by b.SceneId