sqlserver查询更新语句

update WORK_ORDER set creatorDepartment =  t.Name from WORK_ORDER w , (select a.woId,b.creator,a.creatorDepartment,d.Name from WORK_ORDER a left join EFLOW_WO_COMMON b  on a.woid = b.woId
left join U32.dbo.PersonView c on b.creator = c.ObjectID
left join U32.dbo.OrganizationView d on c.OrganizationID = d.MDB_UNIQUE_ATTR where a.creatorDepartment != d.Name
) t where w.woId = t.woId

猜你喜欢

转载自zjhdreams.iteye.com/blog/2354162