select col1,max(col2) from t group by col1

解决方案 »

  1.   

    厉害厉害!
    不过表数据要是如下:
    A,K,1
    A,M,2
    A,N,3
    B,W,1
    B,Y,10
    C,U,5
    C,T,7
    我想把数值最大的取出来,理想结果集是:
    A,N,3
    B,Y,10
    C,T,7
    又该如何写SQL语句呢?
      

  2.   

    select * from t tt where (clo1,col2) in ( select col1,max(col2) from t group by col1)
      

  3.   

    暈﹐錯了一點
    select * from t tt where (clo1,col3) in ( select col1,max(col3) from t group by col1)