只是偶尔出现,插入表里面的时候会出现一样的重复数据,现在要怎么删除呢,有什么方法避免么,因为是偶尔出现,不知道什么原因

解决方案 »

  1.   

    有没有主键?
    比如ID自增delete a
    from tablename a
    where not exists(select 1 from tablename where a.col = col and a.id < id)
    有什么方法避免么,因为是偶尔出现,不知道什么原因
    --检查事务控制
      

  2.   

    是这样的
    BH(编号)   JinE(金额)   OPT(操作员)   ID(自增列)
    正常数据可以是这样
    0001       100         001           1
    0001       50          001           2
    但是现在出现有时出现
    0001       100         001           1
    0001       100         002           2
    0001       50          001           3