update t1 set t1.value=t2.value from t2 where t1.id=t2.id
update jbsite_class set topicnum = count
from (select t2.classid,count from (
select distinct classid,count(*) as count
from jbsite_product
group by classid) t2
inner join jbsite_product on jbsite_product.id = t2.classid
) b where jbsite_class.id=b.classid
Sql Server根据记录集批量更新数据库
最新推荐文章于 2022-07-25 14:25:08 发布