Thursday, June 18, 2015

SQL nested case when then

 CASE
WHEN alertcon.alert_type = 'E'
THEN
CASE
    WHEN alertgat.gateway_id = 'M' THEN escUser.login_id
    WHEN alertgat.gateway_id = 'E' THEN escUser.email_id
    ELSE ''
END
WHEN alertcon.alert_type = 'R'
THEN
CASE
   WHEN alertgat.gateway_id = 'M' THEN escUser.login_id
   WHEN alertgat.gateway_id = 'E' THEN escUser.email_id
    ELSE ''
END
END as Recepient

No comments:

Post a Comment