如:
A B C
1 3 4
2 5 2
1 3 1
4 5 2
2 5 8
1 3 9
然后删除字段A和字段B相同的记录只保留最后一记录
删除后为
A B C
4 5 2
2 5 8
1 3 9谢谢

解决方案 »

  1.   

    不应该是删除,而是你在绑定前的查询就做unique吧
      

  2.   

    如果是从数据库中读取的,在读取时就distinct掉
      

  3.   

    楼上的办法比较好.如果你想直接在DATATABLE中处理的话,
    不知道要循环多少次.
      

  4.   

    可我这不是从数据库里面读出来的,而是自己在asp.net建的表
    谢谢
      

  5.   

    select * from 
    tab t where c in(select top 1 c from tab where a=t.a and b=t.b order by id desc )
      

  6.   

    select * from 
    tab t where c in(select top 1 c from tab group by c having count(c)=1)