select   *   from   tb where (id   is   NULL) and (del=0)
为什么查不出来记录,明有满足该条件的记录,就是不显示   is   NULL
和 and 不能一起用吗?

解决方案 »

  1.   

    select  *  from  tb where id='NULL' and del=0 
      

  2.   

    select  *  from  tb where isnull(id,0)=0 and (del=0) 
      

  3.   

    create table tb(id int , del int)
    insert into tb(del) select 0
    insert into tb(del) select 1
    insert into tb(id ,del) select 2,2
    insert into tb(id ,del) select 4,1
    select * from tb where id is null and del = 0/*
    id   del
    ---------------
    NULL  0
    */drop table tb
      

  4.   

    select  *  from  tb where isnull(id,0)=0 and (del=0)