select * from 表 as AA where not exists(select 1 from 表 as BB where AA.字段1=BB.字段1 and AA.字段2<BB.字段2)

解决方案 »

  1.   

    1:
    Select 字段1,sum(字段2) as 字段2 from 表
    group by 字段1
    order by sum(字段2)2:最后每个分组取最上一条记录。(既然是分组就只有一条记录啊?)
      

  2.   

    1:最后每个分组取最上一条记录。(分组就只有一条记录啊)
    2:select 字段1,sum(字段2) from 表 order by sum(字段2)
      

  3.   

    1:最后每个分组取最上一条记录。(分组就只有一条记录啊)
    2:select 字段1,sum(字段2) from 表 order by sum(字段2)
      

  4.   

    select ColnameA from Tablename group by ColnameA order by ColnameB
      

  5.   

    什么意思?你按1分组?然后在按2排序?
    不可能的啊 !!你按2排序,那么2必定分组后数据里面,那么2必定也要在group by里取第一条用top 1
      

  6.   

    select * from 表 as A 
    where 字段2 = (select top 1 字段2 from 表 where 字段1=A.字段1 order by 字段2)
      

  7.   

    一楼的我理解起来有点难度。。不过似乎是对的
    二楼的为什么要有sum?字段2不是数值型的
    三楼的那个是不对的
      

  8.   

    你是要这个: select * from 表 tem where 字段2=(select top 1 字段2 from 表 where 字段1=tem.字段1)
      

  9.   

    你是要这个: select * from 表 tem where 字段2=(select top 1 字段2 from 表 where 字段1=tem.字段1)
      

  10.   

    select * from 表 tem where 字段2=(select top 1 字段2 from 表 where 字段1=tem.字段1 order by 字段2)或:select * from 表 tem where 字段2=(select min(字段2) from 表 where 字段1=tem.字段1)你可以试试。
      

  11.   

    chenxi_aji(阿吉) ,我的肯定是对的.:)
      

  12.   

    我现在理解了,哈哈,谢谢, CrazyFor(太阳下山明朝依旧爬上来)的那个的确最好