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

来源:互联网 发布:淘宝怎么认证企业店铺 编辑:程序博客网 时间:2024/06/05 10:47

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

原创粉丝点击