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
相关文章
- 04-10update field
- 04-10高中语法探索(update...)
- 04-10Django | 模型类变更后生成迁移文件,报错:You are trying to add a non-nullable field 'BookName' to BookInfo without a default....
- 04-10How to sort the dictionary by the value field
- 04-10mac 开发必备软件(不断update ing...)
- 04-10使用可重复读隔离时,SELECT .. FOR UPDATE有什么用?
- 04-10Warning: Cannot update during an existing state transition (such as within `render`). Render 报错
- 04-10sql-update语句多表级联更新
- 04-10ftp unable to fetch some archives,maybe run apt-get update or try with -- fix-missing?
- 04-10rosdep update time out及失败解决方案