http://community.csdn.net/Expert/topic/3687/3687396.xml?temp=.8386499
上面是我以前的问题,问题一样,以前得到结果了,但是那个结果效率太底。
不知道有什么好的方法,效率高的。

解决方案 »

  1.   

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

  2.   

    alter table yourtablename add id int identity(1,1)delete from yourtablename a 
        (select 字段1,min(id) from yourtablename where 字段1 in (select 字段1 from yourtablenam group by 字段1)
    group by 字段1) b
    where a.字段1=b.字段1 and a.id=b.idalter table yourtablename drop id
      

  3.   

    重要改正:
    alter table yourtablename add id int identity(1,1)select a.* from yourtablename a 
        (select 字段1,min(id) from yourtablename where 字段1 in (select 字段1 from yourtablenam group by 字段1)
    group by 字段1) b
    where a.字段1=b.字段1 and a.id=b.idalter table yourtablename drop id