DELETE FROM d_zhongchejlcx WHERE CHARINDEX('aa', dw1)>0 or CHARINDEX('aa', dw2)>0

解决方案 »

  1.   

    DELETE FROM d_zhongchejlcx WHERE dw1 like '%aa%' or dw2 like '%aa%'還可用patindex函數
      

  2.   

    我是用DELETE 实现删除多余的记录,保留符合条件的记录,上面好象是删除保留符合条件的记录了
      

  3.   

    DELETE FROM d_zhongchejlcx WHERE dw1 not like '%aa%' or dw2 not like '%aa%'

    delete from d_zhongchejlcx where xph not in(select xph FROM d_zhongchejlcx WHERE dw1 like '%aa%' or dw2 like '%aa%'
    )
      

  4.   

    --没问题呀!
    create table #aa(id int,name varchar(10))
    insert #aa select 1,'eeeee'
    union all select 2,'asdf'
    union all select 3,'rrrr'
    select * from #aa
    delete from #aa
    where name not like '%rrrr%'
    select * from #aa
    drop table #aa