select NO,CITY=MIN(CITY) from A group by NO order by NO

解决方案 »

  1.   

    select no,max(city) from a group by no
    但这样不是按顺序取得
      

  2.   

    select identity(int,1,1) ID,* into # from Aselect NO,CITY
    from # t
    where not exists(select 1 from # where NO=t.NO and ID<t.ID)
      

  3.   

    select * ,identity(int,1,1) as id into #t from tb
    select a.NO,a.CITY
    from #t a where not exists(select * from #t b where a.no=b.no and b.id<a.id)
    drop table #t
      

  4.   

    libin_ftsafe(子陌红尘) 正解。
      

  5.   

    vivianfdlpw() 和 wgsasd311的正确。用MIN或MAX都是错误的,取得都不是第一条而是最小或最大一条。