select TelNumber,min(Coefficient) Coefficient from tablename group by TelNumber

解决方案 »

  1.   


    insert into #temp2 select '13900010001',                    2025417 union all
    select '13900010002',                    1437619 union all
    select '13900010003',                    6053827 union all
    select '13900010004',                    5778713 union all
    select '13900010005',                    160204 union all
    select '13900010001',                    5733291 union all
    select '13900010006',                    8027933 union all
    select '13900010007',                    8248841
     
    select * from #temp2 as a where not exists (select 1 from #temp2 where telnumber=a.telnumber and Coefficient>a.Coefficient)
      

  2.   

    没大弄明白你到底要实现什么?
    如果是只想查找出来TelNumber不重复的行,那这里的任何人都没问题,再深的东西,偶没看明白你的意思,尤其:查询出来的结果是 TelNumber 不能有重复的记录,而 Coefficient 允许有重复的记录,即 TelNumber只能不能有一个 13900010001,可以是第 1 条,也可以是第 6 条上面这句话是什么意思,什么是“只能不能有一个”?