C重复时,B、D两列如何取舍?

解决方案 »

  1.   

    A B C D
    1 1 1 1
    2 1 1 2
    3 2 2 3
    4 2 1 4
    5 2 1 3查询出来得:
    A B C D
    1 1 1 1
    3 2 2 3
      

  2.   

    select min(A),min(B),c,min(D) from table group by c
      

  3.   

    http://community.csdn.net/Expert/topic/3249/3249349.xml?temp=.7773249
      

  4.   

    leeyoong(莫西) 的可以
    create table t  (A varchar(1),B varchar(1),C varchar(1),D varchar(1))
    insert into t values('1','1','1','1')
    insert into t values('1','1','1','1')insert into t values('2','1','1','2')insert into t values('3','2','2','3')
    insert into t values('4','2','1','4')insert into t values('5','2','1','3')
    select * from t
    select min(A),min(B),c,min(D) from t group by c
    drop table t
    go
    可以试一下A是主键不可能重复的

      

  5.   

    select * from tablename where a in (select a from (select disinct a,c from tablename) b )楼主试一下
      

  6.   

    上面错了
    select c,min(A),min(B),min(D) from table group by c --pass successfully
    不是每种数据类型都可以max()吧
      

  7.   

    select a,b,c from table 
    where A not in
    (select min(A) from table group by c)