Sql Server根据记录集批量更新数据库

1 update   t1   set   t1.value=t2.value   from   t2   where   t1.id=t2.id
1 update jbsite_class  set topicnum = count 
2 from (select t2.classid,count from (
3 select distinct classid,count(*as count
4 from jbsite_product
5 group by classid) t2
6 inner join  jbsite_product on jbsite_product.id = t2.classid
7 ) b where jbsite_class.id=b.classid
原文地址:https://www.cnblogs.com/skyakira/p/1487183.html