Sql Server根据记录集批量更新数据库
2009-05-22 16:15 迷路中的路人甲 阅读(476) 评论(0) 编辑 收藏 举报
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
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