update tbArticle a set a.ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID)我在ACCESS查询中用上面的语句,老上报语法错误!

解决方案 »

  1.   

    update tbArticle a,b set a.ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID)再试试
      

  2.   

    update tbArticle set ChildNum=(select Count(*) from tbArticle b where b.PID=tbArticle.ID)
      

  3.   

    noil0125(珏心)的语句是可以的,我测试过。
      

  4.   

    哥们,帮我看看我的程序在那里有问题adoquery1.SQL.add('insert into w1 values(1,1,1,1,1)');
     adoquery1.ExecSQL;这是一段连接往sql数据库中插入记录的语句,旧这几条语句,竟然老出错,
    Access violation at address 1F487CAB in module 'msado15.dll'. Write of address 01009024.请高手指点
      

  5.   

    update a set a.ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID)
    from tbArticle a这样试试
      

  6.   

    update a set ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID)
    from tbArticle a这样试试
      

  7.   

    noil0125(珏心)的在SQL中是可以,但在ACCESS中就不行
      

  8.   

    noil0125(珏心)的在MSSQL中是可以,但在ACCESS中就不行
      

  9.   

    是不是access不支持表的别名哦?
      

  10.   

    access设置别名的时候要用 as, 如 tbArticle as a.
      

  11.   

    试试下面的语句:
    update a 
    set a.ChildNum = b.num 
    from tbArticle a , (select id , Count(*) as num from tbArticle group by id ) b
    where a.id = b.id