SqlServer表关联更新

在实际工作中,我们经常需要对多个表进行关联更新,以保持数据的一致性。

update a set a.forward_count = b.read_num, a.like_count = b.like_num 
from [weibo_news_part_xx] a inner join [_xuexi_haidian_3_month_new] b
on a.url = b.url 
where a.wb_nickname = 'XX学习平台' 
and a.publishtime >= '2023-03-01' and a.publishtime < '2023-04-01' 
and a.addtime > '2023-04-11'
and b.read_num <> '/' and b.like_num <> '/';

你可能感兴趣的:(数据库,java,sql,开发语言)