update a set cprs=(select count(*) from b
where a.pxbid=b.pxbid)
where exists (select * from b
where a.pxbid=b.pxbid);

解决方案 »

  1.   

    update a set cprs = (select count(*) from b where a.pxbid = b.pxbid)
      

  2.   

    update a set cprs = (select count(rowid) from b where b.pxbid = a.pxbid group by b.pxbid)
      

  3.   

    有两个表,a 表:pxbid培训班编号(关键字) cprs参培人数
    b表:pxbid培训班编号(关键字)kaohao(关键字)
    现要将统计b表中每个培训班的考生数并更新到a 表相应的cprs字段。
    update a set cprs = (select count(kaono) from b where a.pxbid = b.pxbid)
    where a.pxbid = b.pxbid