sql server多表数据批量更新

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

posted @ 2014-02-27 14:00  xiaofoyuan  阅读(741)  评论(0编辑  收藏  举报