如有下表:
  
  姓名    年度    工资  张三    1990    300
  张三    1991    400
  张三    1992    600
  张三    1995    550
  李四    1992    500
  李四    1993    800
  李四    1994    750
  王某    1993    700
  王某    1995    800要得出这样的结果:某人最大年度的工资额。
   张三  1995   550
   李四  1994   750
   王某  1995   800   

解决方案 »

  1.   

    SELECT MAX(工资),年度
    FROM 表名
      

  2.   

    select a.* from
    table a,
    (select 姓名,max(工资) from table group by 姓名) b
    where a.姓名 = b.姓名 and a.工资 = b.工资
      

  3.   

    select * from table group by 姓名 having max(工资)
      

  4.   

    如果某人有几年的工资都是最大,只需要其中的一条,可以
    select top 1 a.* from
    table a,
    (select 姓名,max(工资) from table group by 姓名) b
    where a.姓名 = b.姓名 and a.工资 = b.工资
    group by a.姓名
    order by 年度
      

  5.   

    select a.* from
    table a,
    (select 姓名,max(年度) from table group by 姓名) b
    where a.姓名 = b.姓名 and a.年度 = b.年度
      

  6.   

    select distinct * from table group by 姓名 having max(年度)
      

  7.   

    select 姓名,max(年度),工资 from table tablename groupby 姓名
      

  8.   

    select distinct * from table group by 姓名 having max(年度)
      

  9.   

    lincanwen(密码错误) 的ORACLE下可以执行, ziqing(紫情), xiehua822(xiehua)效率高但是不知道能否执行,反正这些在ACCESS下均无法执行
      

  10.   

    select a.* from
    table a,
    (select 姓名,max(年度) as 年度1 from table group by 姓名) b
    where a.姓名 = b.姓名 and a.年度 = b.年度1asscess下测试过的。