Reputation: 93
I want to get the output "BR" and "CR" respectively for the following REGEXP_CONTAINS, but I'm getting 'BR' for both. How do i get "BR' for first one and 'CR' for second one.
CASE
WHEN REGEXP_CONTAINS(Title, '(?i)saving') THEN 'BR'
WHEN REGEXP_CONTAINS(Title, '(?i)Life Savings') THEN 'CR'
END;
Upvotes: 0
Views: 454
Reputation: 172994
Simply change order of conditions as in below example
CASE
WHEN REGEXP_CONTAINS(Title, '(?i)Life Savings') THEN 'CR'
WHEN REGEXP_CONTAINS(Title, '(?i)saving') THEN 'BR'
END
Upvotes: 2