update w
set w.TagCount=x.TagCount
from (select ItemID,COUNT(*) as TagCount from r where IsValid=1 group by ItemID) as x
where ID =4 and IsValid=1 and w.ID=x.ItemID
转载于:https://www.cnblogs.com/xiaofoyuan/p/3571358.html
update w
set w.TagCount=x.TagCount
from (select ItemID,COUNT(*) as TagCount from r where IsValid=1 group by ItemID) as x
where ID =4 and IsValid=1 and w.ID=x.ItemID
转载于:https://www.cnblogs.com/xiaofoyuan/p/3571358.html