背景:A表中的一个字段为空,B表中有该字段,把B表中的值按照规则更新到A表中。
//把B表中的ConfigId赋值到A表中,根据A.Name=B.Name连接
update a
set a.ConfigId = b.ConfigId
from PoliticsReimbursementBudget a
inner join PoliticsExpenseCostCollectionConfig b on a.Name = b.Name where a.Name!='' and a.ConfigId is NULL
//查询a中Name不为空的,但是ConfigId为空的
select * from PoliticsReimbursementBudget where Name != '' and ConfigId=''