在access中  select count(*) as 合计 from tablea where tablea.fielda=1  如果不存在的话
返回值不是0 而是空,什么都没有,有没有办法让select count(*) as 合计 from tablea where tablea.fielda=1 如果没有的话 count(*)返回的是0

解决方案 »

  1.   

    楼主说的好象不对!
    在sql2000中如果没有符合条件的记录,select count(*)返回的一定是0!
    access 中应该也一样的!
    你是不是搞错了?
      

  2.   

    你们自己去看看吧,access2000就是这样的
      

  3.   

    select 维修站,count(*)as K系列 from 安装档案 where 型号id like 'A*' group by 维修站应该是像这样,如果维修站 只有一个, 而型号id like 'A*'为false 时,就会为空,什么都没有
      

  4.   

    嗬嗬,不用了,我自己解决了,只要加 select distinct 维修站 left join 就可以咯
      

  5.   

    query1.sql.clear;
    query1.sql.text:='select count(*) as 合计 from tablea where tablea.fielda=1 '
    query1.open;
    if query1.isempty then
     w:=0
    这样就管他返回什么值,只要没有,w的值就为0
      

  6.   

    query1.sql.clear;
    query1.sql.text:='select count(*) as 合计 from tablea where tablea.fielda=1 '
    query1.open;
    if query1.Fields[0].isNull then
     w:=0