select distinct * from 表aa

解决方案 »

  1.   

    看条件像是取最小值,
    select name , min(age) from aa group by name
      

  2.   

    SELECT [Name], MIN(AGE) AS AGE
    FROM aa
    GROUP BY [Name]
      

  3.   

    create table t( names varchar(10), age int)
    insert t select 'aa',1
    union all select 'aa',2
    union all select 'bb',3
    union all select 'bb',4
    union all select 'cc',5
    drop table t
    --select names,min(age)as age from t group by names  方法一
    --方法二
    select * from t a
    where not exists(select * from t
    b where a.names=b.names and b.age<a.age) 
      

  4.   

    --这个也可以,但是还是分组的效率高select * from t a
    where age in(select min(age) from t b where a.names=b.names)