update b set b.cnum = (select c.counts from
(SELECT cid,COUNT(*) counts FROM comment GROUP BY cid) c
where a.cid=c.cid);
哎,禁不住说一声,苦逼程序员啊,都这么晚不睡
你试试吧,按照你描述的,我这么写应该就通过了,有问题直接hi
Update B
set B.cnum = A.Total
From B
INNER JOIN (SELECT cid,COUNT(*) AS Total FROM A GROUP BY cid) A
ON B.cid =A.cid
update b
set b.cnum = a.cnum
From (select cid,count(*) AS cnum from a group by cid) a
where b.cid =a.cid
不知道就说不知道的。还不能跟from。无知真可怕,lz回家吃奶吧