select 字段1, min(字段2), 字段3,字段4 from test group by 字段1

解决方案 »

  1.   

    SELECT IDENTITY(int, 1,1) AS ID_Num
    INTO #NewTable
    FROM (select * from YouTable
          where 字段1 in(select 字段1 from YourTable
                           group by 字段1
                              having count(*) > 1)as a) as b
    select * from #NewTable
    where ID_Num in (select min(ID_Num) from #NewTable
                        group by 字段1)
      

  2.   

    SELECT IDENTITY(int, 1,1) AS ID_Num
    INTO #NewTable
    FROM (select * from YouTable
          where 字段1 in(select 字段1 from YourTable
                           group by 字段1
                              having count(*) > 1)) as b
    select * from #NewTable
    where ID_Num in (select min(ID_Num) from #NewTable
                        group by 字段1)
      

  3.   

    select 字段1,min(字段2),字段3,字段4
     from yourtable  where 字段1 in  
    (select 字段1 from yourtable group by 字段1
      having count(字段1 )>1)
      

  4.   

    试试这个
    select 字段1, min(字段2), 字段3,字段4 from test 
    where ascII(left(字段1,1))%2=1 group by 字段1
      

  5.   

    select * from yourtable o
    where 字段2 in
    (
    select 字段2 from yourtable i where i.字段1=o.字段1 
    and i.字段2 =(select min(字段2) from yourtable 
              where 字段1=i.字段1 group by 字段1) 
    group by i.字段2 having count(i.字段1)>1
    )