日期:2014-05-17  浏览次数:20775 次

查询一个表的一条记录
我想查询一分组记录的全部记录;
比如:select   max(score)   from   students   group   by   name;
这只能查出max(score)的值,但我想查询此记录的其他字段的值,请问该如何做?

------解决方案--------------------
select s.* from students s where not exists(select 1 from students where name=s.name and score> s.score)

select s.* from students s,(select name,max(score) as score from students group by name) v where s.name=b.name and s.score=v.score