Hi,
Below is one conversion, I am looking for generic template to be applied across SQL server code and that is the reason that update statement is not broken into multiple statements for left join. Please let me know if I am missing some future data issues with this code.
UPDATE a
FROM TAC_CDD_TodayCDD_CountryRisk a,
(SELECT b.BRANCH_RISK_FACTOR,a.ABC_Risk_wo_Override, a.REVIEW_ID,a.ABC_Country, a.Client_GID
FROM TAC_CDD_TodayCDD_CountryRisk a
LEFT JOIN TAC_CDD_ABC_Uplift b ON b.REVIEW_ID = a.REVIEW_ID
AND b.COUNTRY_NAME = a.ABC_Country) M
SET ABC_Risk =
CASE WHEN M.BRANCH_RISK_FACTOR = 'Undefined' THEN a.ABC_Risk_wo_Override
WHEN M.BRANCH_RISK_FACTOR = 'Accepted' THEN a.ABC_Risk_wo_Override
WHEN M.BRANCH_RISK_FACTOR IS NULL THEN a.ABC_Risk_wo_Override
ELSE COALESCE(M.BRANCH_RISK_FACTOR, a.ABC_Risk_wo_Override)
END
WHERE
COALESCE(m.Client_GID,'') = COALESCE(a.Client_GID ,'')
AND COALESCE(m.ABC_Country,'') = COALESCE(a.ABC_Country,'')
AND m.REVIEW_ID = a.REVIEW_ID
Thanks
Harpreet
Hi,
Below is one conversion, I am looking for generic template to be applied across SQL server code and that is the reason that update statement is not broken into multiple statements for left join. Please let me know if I am missing some future data issues with this code.
Thanks
Harpreet