如何使用案例更新查询? [英] How do I use update query with case?

查看:96
本文介绍了如何使用案例更新查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用案例更新查询,来自



附近的语法不正确



我尝试了什么:



i want to use update query using case, with from

incorrect syntax near from

What I have tried:

 update A_SalaryConsolidated set bonus=case when a.final_payable >bonus then bonus else (bonus+a.final_payable) 
 from  
  (select empid,final_payable from Bonus
  inner join monthdigit on month=monthView     where monthnumber= 5 and year = 2017
 and Bonus.empid in(select  a.empid from(select empid from Bonus 
 inner join monthdigit on month=monthView where monthnumber=5 and year=2017  and final_payable>0  and unitid=145) as a )) as a 
inner join A_SalaryConsolidated on a.empid=A_SalaryConsolidated.staffid   where month ='July' and year = '2017'  

推荐答案

你好,

您在案例陈述中错过了 end 。把 结束 然后试试。

谢谢
Hello,
You have missed end in case statement. Put end and then try.
Thanks


这篇关于如何使用案例更新查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆