百科知识

vfp中如何删除重复数据有一个数据库,格式如下idnameage

2006-10-17 14:47:00l***
有一个数据库,格式如下 id name age code 1 aaa 10 100 2 aab 11 101 3 aac 13 100 4 aad 11 102 5 acc 10 101 如何将code字段中相同的记录删除呢?vfp中如何删除重复数据有一个数据库,格式如下idnameagecode1aaa101002aab111013aac131004aad111025acc1010?

最佳回答

  • 用一句SQL是可以实现的,但是只能保留重复行中的最大或者最小ID的那一行。没办法,你连个表名都不给,只好假定表名是:table_name。 语句如下: delete from table_name where code in (select code from table_name group by code having count(code) > 1) and id not in (select max(id) from table_name group by code having count(code) > 1) ;
    2006-10-17 16:42:21
  • select dist * from code wherecode=100
    2006-10-17 15:00:38
  • 很赞哦! (214)