表结构如下:
a   b    c    d    e
1   4    5    3    2
1   4    5    2    3
1   4    5    2    2
2   4    5    3    2
2   4    5    3    1
3   5    6    8    5我只想把字段A重复的记录找出来。相同记录的其它字段值取第一条重复记录的值。结果如下:
1   4    5    3    2
2   4    5    3    2
3   5    6    8    5请问用SQL如何实现?谢谢

解决方案 »

  1.   

    select distinct tablename.a, tablename.b, tablename.c, tablename.e,  from tablename
      

  2.   

    select distinct tablename.a, tablename.b, tablename.c, tablename.e  from tablename order by a,b 
      

  3.   

    select distinct a,b,c,d,e from tablename order by a,b;
      

  4.   

    select * from table t1 where b=(select top one b where a=t1.a ) and c=(select top one c where a=t1.a) and d=(select top one d where a=t1.a) and e=(select top one d where a=t1.a)
      

  5.   

    select A,B,C,D,E from (select rownum AA,A,B,C,D,E from A) A where AA in (select MIN(ROWNUM)   from A GROUP BY A)