declare @GG int,@MM int
select @GG=count(*) from stuInfo where stuSex='男'
select @MM=count(*) from stuInfo where stuSex='女'
print '男生人数为:'+Convert(varchar(10),@GG)
print '女生人数为:'+Convert(varchar(10),@MM)
select count(ssex)
from stud
where stud.ssex='?'(?是男的编码或女的编码)
select stud.ssex,count(stud.id)
from stud
group by stud.ssex
select count(1),ssex from stud group by ssex
select ssex,count(*) from stud group by ssex