select count(*) from pw_points_b2c where coalesce(pw_downdate,'')=''
同一个语句,在一个库中查到3,另外一个库中查到0,怎么回事,两个库中的数据也是一样的

解决方案 »

  1.   

    select count(*) from pw_points_b2c where coalesce<=>null;这样去两个库查询看看。你上面的语句和<=>NULL是相同的结果。
      

  2.   

    写错了。不好意思。。
    应该是这样的。
    select count(*) from pw_points_b2c where pw_downdate<=>null;
      

  3.   

    select pw_downdate,length(pw_downdate) from pw_points_b2c;
    select pw_downdate,length(pw_downdate) from pw_points_b2c where downdate='';
    select pw_downdate,length(pw_downdate) from pw_points_b2c where downdate<=>null;可能是存了有空字符进去,看起来是空的,其实不是NULL。
      

  4.   

    length了一下是19位,这个列是datetime的数据类型,会是什么值呢