select * from tablename a
where 标识=(select min(标识) from tablename where 学生名=a.学生名)

解决方案 »

  1.   

    select * from tablename a
    where 标识=(select top 1 标识 from tablename where 学生名=a.学生名 order by 家长收入 desc)
      

  2.   

    Select a.* from a
    join 
    (Select 班级,学生名,max(家长收入) as 家长收入 group by 班级,学生名 ) b
    on a.班级 = b.班级 and a.学生名 = b.学生名 and a.家长收入= b.家长收入
      

  3.   

    Select a.* from table a
    join 
    (Select 班级,学生名,max(家长收入) as 家长收入 group by 班级,学生名 ) b
    on a.班级 = b.班级 and a.学生名 = b.学生名 and a.家长收入= b.家长收入
      

  4.   

    注意 家长收入 有相同的情况,所以用top 1保险
      

  5.   

    select * from 学生家长登记表 a where  a.标识 in (select top 1 标识 from 学生家长登记表 b  where a.学生名=b.学生名 order by 家长收入 desc)
    order by a.标识
      

  6.   

    我想楼主的要求是这样的
      Select a.* from 学生家长登记表 a 
        inner join 
     (select 学生名,max(家长收入) as 家长收入 from 学生家长登记表 group by 学生名 ) b
      on a.学生名 = b.学生名 and a.家长收入= b.家长收入
      

  7.   

    正確的答案來了.給分吧.
    select a.* from aa a inner join 
    (
    select class,student,max(sr) as sr from aa group by class,student
    ) b on a.class=b.class and a.student=b.student and a.sr=b.sr order by id
      

  8.   

    create table student( id int identity(1,1),class int  ,sname varchar(6),pname varchar(6),income dec(12,2))
    insert into student(class,sname,pname,income) values(1,'张三','张勇国',2000)
    insert into student(class,sname,pname,income) values(1 ,'张三','李绣莲',900) 
    insert into student(class,sname,pname,income) values(2,' 李四','李永进',3000) 
    insert into student(class,sname,pname,income) values( 2,'王五','王大力', 800) 
     select id,a.class,a.sname ,pname,a.income from student a,(select class,sname,max(income ) income
    from student 
    group by class,sname) b
    where a.class=b.class and a.sname=b.sname and a.income =b.income
    order by id
      

  9.   

    谢谢大家支持。学生名那个字段本来是学生编号的,我是为了说明方便写成学生姓名的。我的方法是:Select tblB.*,tblA.标识,tblA.班级,tblA.家长名 From (SELECT 学生名, MAX(家长收入) AS 家长收入 FROM 学生家长登记表  
    GROUP BY 学生姓名) tblB   
    Left Outer Join 学生家长登记表 tblA  
    On tblB.学生名=tblA.学生名 and tblB.家长收入=tablA.家长收入