见上图,在“ENDNO”里面,有些值是“STARTNO”里没有的,怎么把这些值筛选出来,然后把其所在的一整行数据都删掉比如第2行的 ZQWJ002-2 在“STARTNO”里面就没有,就要把这一行记录删掉

解决方案 »

  1.   

    -- 就是简单的删除吗?
    delete t where STARTNO is null 
      

  2.   

    delete from table t where t.startno not in (select distinct t.endno from table);
      

  3.   

    delete from  test t where not exists (  select 1 from  test t1 where t1.STARTNO= t.ENDNO);
      

  4.   

    delete from table t where t.endno not in (select startno from table);
      

  5.   

    delete from table where startno is null
      

  6.   


    DELETE FROM TABLE T WHERE T.endno NOT IN(SELECT DISTINCT endno FROM TABLE)
      

  7.   

    DELETE FROM TABLE T WHERE T.endno NOT IN(SELECT DISTINCT endno FROM TABLE)
      

  8.   

    DELETE FROM table WHERE startno IS NULL