update tbArticle a,b set a.ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID)再试试
update tbArticle set ChildNum=(select Count(*) from tbArticle b where b.PID=tbArticle.ID)
noil0125(珏心)的语句是可以的,我测试过。
哥们,帮我看看我的程序在那里有问题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.请高手指点
update a set a.ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID) from tbArticle a这样试试
update a set ChildNum=(select Count(*) from tbArticle b where b.PID=a.ID) from tbArticle a这样试试
noil0125(珏心)的在SQL中是可以,但在ACCESS中就不行
noil0125(珏心)的在MSSQL中是可以,但在ACCESS中就不行
是不是access不支持表的别名哦?
access设置别名的时候要用 as, 如 tbArticle as a.
试试下面的语句: 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
adoquery1.ExecSQL;这是一段连接往sql数据库中插入记录的语句,旧这几条语句,竟然老出错,
Access violation at address 1F487CAB in module 'msado15.dll'. Write of address 01009024.请高手指点
from tbArticle a这样试试
from tbArticle a这样试试
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