如何根据性别求学生数量 我这里有一张表pa(id,stuid,stuName,sex,address),我如何用sql语句求女生的人数 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(distinct stuid)from tbwhere sex = '女' select count(1) from tb where sex='女' select sum(case when sex='女' then 1 else 0 end) [女生人数], sum(case when sex='男' then 1 else 0 end) [男生人数]from tb select count(*) from tb where sex ='女' select sum(case sex when '女' then 1 else 0 end) [女生人数] from tb select count(distinct stuid) from PA where sex = '女'排除了重复的数据 一个SQL query 问题~谢谢 很菜的问题关于ER图 数据库的差怎么做 新手学习数据库怎么入门 sql语句书写,根据查询条件和数据内的字段查询交集记录 sql语句 查询倒数第2条记录开始的语句 求SQL语句或存储过程 请教在SQL SERVER 删除重复记录的问题. 使用SQL语句创建一个表,如何使这个表的表名为当前时间??语句怎么写?(精确到秒) 谢谢! 如何字段b找出<a的最大一条? 求教一个字符串截取的问题 这个sql为什么会造成堵塞
select count(distinct stuid)
from tb
where sex = '女'
select sum(case when sex='女' then 1 else 0 end) [女生人数],
sum(case when sex='男' then 1 else 0 end) [男生人数]
from tb
排除了重复的数据