Name    value
张三    1
张三    4
李四    5
李四    8
王五    3select 后
张三    4
李四    8
王五    3

解决方案 »

  1.   

    select name,max(`values`) from table1 group by name
      

  2.   

    参考下贴中的多种方法http://topic.csdn.net/u/20091231/16/2f268740-391e-40f2-a15e-f243b2c925ab.html
    [征集]分组取最大N条记录方法征集,及散分....
      

  3.   

    select *
    from tb A
    where not exists (select 1 from A.name=name and A.value<value)
      

  4.   

    假设VALUE唯一
    select `name`,max(`values`) from tt group by `name`
    or
    select * from tt A
    where not exists (select 1 from A.`name`=`name` and A.`value`<`value`)
      

  5.   

    mysql>select name,max(value) from tbl_name group by name;