UPDATE dbo.HotelPolicy SET HPFactorMark=TB.MarkValue FROM
(select HPF.HPFRPolicyId AS ID ,CONVERT(int,ISNULL(SUM(POWER(2,HPF.HPFRFactorId-1)),0)) AS MarkValue
FROM HotelPolicyFactorRelation HPF
inner join dbo.HotelPolicy HP on HPF.HPFRPolicyId=HP.Id
WHERE HPF.HPFRFactorId NOT IN (5,7,8,9)
GROUP BY HPF.HPFRPolicyId
) AS TB
WHERE HotelPolicy.Id=TB.ID
相关文章
- Webserver管理系列:3、Windows Update
- Ubuntu Update-rc.d命令详细介绍
- NHibernate中session.update()及session.merge()的区别
- hibernate save,update,saveorupdate方法有什么区别
- QT update和repaint的区别
- Qt常用函数 记录(update erase repaint 的区别)
- Hibernate中load与get,update与merge方法的区别
- for update 和 t.rowid的区别
- MySQL - 问题集 - 触发器更新本表数据异常"Can’t update table ‘tbl’ in stored function/trigger because it is already used by statement which invoked this"
- pt-online-schema-change中update触发器的bug