Click here to Skip to main content
15,891,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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'  
Posted
Updated 14-Sep-17 21:49pm
v2

1 solution

Hello,
You have missed end in case statement. Put end and then try.
Thanks
 
Share this answer
 
Comments
neeraj_ 15-Sep-17 4:38am    
thanks ;)
Animesh Datta 15-Sep-17 6:02am    
glad to help you....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900