Select 用户名,Min(ID) from 表 Group by 用户名

解决方案 »

  1.   

    Select 用户名,Min(ID) from 表 Group by 用户名
      

  2.   

    Select 用户名,Min(ID) from 表 Group by 用户名
      

  3.   

    select 列1,min(列2) from 表 group by 列1
      

  4.   

    不好意思,其实我的原意是想显示distinct 用户名,而其它列不一定是ID,而是多列别的内容。
      

  5.   

    那用临时表.select id=identity(int,1,1),* into #tb from 你的表select * from #tb a where id=(select min(id) from #tb where 用户名=a.用户名)drop table #tb