select * from t_table where id like '%__%' and flag <>'1'

解决方案 »

  1.   


    这么查询不是把的所有的ID都查出来了吗?我只想查ID是两位数,并且flag字段不为1的数据
      

  2.   

    是不是没有符合条件的记录
    select * from t_table where id like '__' and flag <>'1'
      

  3.   

    select * from t_table where id like '%__%' and flag <>'1'
    and len(id)=2
      

  4.   

    select * from t_table where id like '%__%' and flag <>'1' OR FLAG IS NULL
      

  5.   


    select * from t_table where id like '%%' and flag <>'1'
    and len(id)=2
      

  6.   

    select * from t_table where len(id)=2 and (flag <>'1'
     or flag is null)
      

  7.   

    select * from t_table where len(id)=2 and (flag <>'1'
     or flag is null)
      

  8.   

    select * from t_table where len(id)=2 and  isnull(flag,0) <>'1'
     
      

  9.   

    select * from t_table where len(id)=2 and  isnull(flag,0) <>'1'