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
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