and more in a single search tool across platforms. Read the announcement here. |
01/19/2024 12:10 AM - edited 01/19/2024 12:11 AM
Hi Team,
Can you some help on Enhanced Query build for column update with via Case statement.
Please find below SQL Script
update accounts as a
join user_accounts as ua on a.ACCOUNTKEY = ua.ACCOUNTKEY
join users as u on ua.userkey = u.userkey
set a.CUSTOMPROPERTY28 = ( CASE WHEN u.CUSTOMER ='1' THEN 'Cognizant India' WHEN u.CUSTOMER ='4' THEN 'NTT DATA' WHEN u.CUSTOMER ='6' THEN 'Telus Guatemala' END )
where a.ENDPOINTKEY in (SELECT ENDPOINTKEY FROM ENDPOINTS WHERE ENDPOINTNAME ='EBS' ) and a.name = u.systemusername and a.CUSTOMPROPERTY29 is null;
Solved! Go to Solution.
01/19/2024 05:10 AM
SELECT
a.accountkey as accounts__primarykey,
(CASE
WHEN u.CUSTOMER = '1' THEN 'Cognizant India'
WHEN u.CUSTOMER = '4' THEN 'NTT DATA'
WHEN u.CUSTOMER = '6' THEN 'Telus Guatemala'
END) AS accounts__CUSTOMPROPERTY28
FROM
accounts AS a
JOIN
user_accounts AS ua ON a.ACCOUNTKEY = ua.ACCOUNTKEY
JOIN
users AS u ON ua.userkey = u.userkey
WHERE
a.ENDPOINTKEY IN (SELECT ENDPOINTKEY FROM ENDPOINTS WHERE ENDPOINTNAME = 'EBS')
AND a.name = u.systemusername
AND a.CUSTOMPROPERTY29 IS NULL;
01/22/2024 04:24 AM
We got the solution, thank you