如何查询字段不包含 'a','b','c'...的记录????比如:'a123'、'b123'、'c123'、都不符合。。

解决方案 »

  1.   

    select *
    from tb 
    where charindex('a',字段)<0 and 
    charindex('b',字段)<0 and
    charindex('c',字段)<0 and
      

  2.   

    select *
    from tb
    where charindex('a',col)=0 and charindex('b',col)=0 and charindex('c',col)=0
      

  3.   

    select *
    from tb
    where patindex('%[abc]%',col)=0
      

  4.   

    修改下 汗。 把<0都改成=0 。select *
    from tb 
    where charindex('a',字段)=0 and 
    charindex('b',字段)=0 and
    charindex('c',字段)=0 
    汗....不好意思 
      

  5.   

    select *
    from tb
    where col not like '%a%' or 
    col not like '%b%' or 
    col not like '%c%'