| Update query using case when exists [message #573922] |
Fri, 04 January 2013 05:38  |
 |
cplusplus1
Messages: 30 Registered: October 2012 Location: usa
|
Member |
|
|
I am trying to use the below query, is there any other better way than the below.
update t_emp set TTL_FLG =
CASE
WHEN EXISTS
(SELECT 1 from Schema1.T_STG_LW_EMP E
WHERE E.Employee = Schema2.T_emp.EMPLOYEE_NUMBER
AND E.JB_CODE like '%TP%' or E.JB_CODE like '%DGD%' or E.JB_CODE like '%PDD%'
or E.JB_CODE like '%YND%'
)
THEN 'Y'
ELSE 'N'
END;
Thanks a lot for the helpful info.
[Updated on: Fri, 04 January 2013 05:45] Report message to a moderator
|
|
|
|
|
|