select * from tb where id not in('1','3')

解决方案 »

  1.   


    flag is not null
      

  2.   

    select * from tb where flag<>''
      

  3.   

    select * from tb where flag='' and flag is null
    modify
      

  4.   

    select * from tb where flag='' or flag is null 
    汗,and 用错了.
      

  5.   

    就是 一行记录中 有personid 为1     flag 为1,2,3
    可以看出personid 在 flag中是存在的.
    也就是判断,如果personid在flag中存在,就把该行的记录过滤掉.
      

  6.   

    select * from tb where charindex(personid,flag)>0
      

  7.   

    select  *  from tablename where charindex(cast(personid as varchar)+',',flag)>0 or  charindex(','+cast(personid as varchar),flag)>0
      

  8.   


    select * from tb where charindex(personid,flag)<=0