日期:2014-05-18  浏览次数:20384 次

从一个班中选出全班最高的男女同学各一人,一共2人, 不用 UNION 怎么做
如题

------解决方案--------------------
select * from tb
where not exists(select 1 from tb as t where 身高> tb.身高 and 性别=tb.性别)
------解决方案--------------------
select * from 表 a where 身高=(select top 1 身高 from 表 where 性别=a.性别 order by 身高 desc)
------解决方案--------------------
select max(身高) from tb group by 性别;