我的更新语句如下
update tab1
set hdzk = 0
where (cllx like 'G%' or cllx like 'B%' or cllx like 'H%' or cllx like 'Q%')
and (hdzk is not null or hdzk <> 0);
commit;
提示更新成功结果我用下面的语句查还是还有
select count(*)
from tab1
where (cllx like 'G%' or cllx like 'B%' or cllx like 'H%' or cllx like 'Q%')
and (hdzk is not null or hdzk <> 0);

解决方案 »

  1.   

    肯定出来:
    你要知道hdzk is not null or hdzk <> 0 包括了hdzk=0的集合
      

  2.   

    hdzk is not null or hdzk <> 0
    ??
    是不是 hdzk is not null and hdzk <> 0
      

  3.   

    to w_tsinghua() :
    hdzk is not null or hdzk <> 0 这一句不包括了hdzk=0的集合
      

  4.   

    w_tsinghua()说的没错,你的条件有逻辑问题
    ^_^>update test set id=0 where id=3;已更新 1 行。^_^>select id from test;        ID
    ----------
             1
             1
             2
             2
             1
             0已选择6行。^_^>select id from test where id is not null or id<>0;        ID
    ----------
             1
             1
             2
             2
             1
             0已选择6行。
      

  5.   

    hdzk is not null 包含了 hdzk <> 0 的项目
    也包含了hdzk = 0 的项目
    楼主仔细考虑考虑