有一个表如果我想删除表里面  标题中不包含 "哈哈"  是其他数据,sql怎么写啊谁知道啊

解决方案 »

  1.   

    select * from 表名
    where not exists(select 1 from 表名 where charindex('哈哈',标题)>0)
      

  2.   

    delete from 表名
    where not exists(select 1 from 表名 where charindex('哈哈',标题)>0)
      

  3.   

    DELETE FROM Spzs WHERE 
    (NOT EXISTS (SELECT *1 FROM spzs WHERE charindex('挖掘机', cmpc) > 0))我的字段名是 cmpc  怎么说我列名无效啊
      

  4.   

    -------你先查询一下看看出不出问题
    SELECT * FROM spzs WHERE charindex('挖掘机', cmpc) > 0--你的写的不对啊~~~
    DELETE FROM Spzs WHERE NOT EXISTS (SELECT 1 FROM spzs WHERE charindex('挖掘机', cmpc) > 0)
      

  5.   

    delete from 表名 where charindex('哈哈',标题)=0
      

  6.   

    DELETE FROM Spzs WHERE charindex('挖掘机', cmpc) = 0
      

  7.   

    select * from spzs where cmpc not like '%挖掘机%'