比如我现在要做一个这样的查询
1 a
1 c
1 b
2 a
2 b
3 a
.....以前面数字分组,字母倒序,每组取一条
这样怎么写啊

解决方案 »

  1.   

    select 数字,max(字母) from TName group by 数字
      

  2.   

    select * from tablename t1
    where column1 = (select top 1 column2 from tablename where column1 = t1.column1 order by column2 desc)
      

  3.   

    LiBin_OberthurCS(子陌红尘) ( ) 信誉:100 
    这是什么意思?
      

  4.   

    问一下
    如果第2列不是字母,是一列datetime型,日期呢
      

  5.   

    select 数字,max(日期) from TName group by 数字
      

  6.   


    对的,谢谢各位,有其是LiBin_OberthurCS(子陌红尘) 谢谢