I'm trying to find a way to convert two booleans into a case when expression

0

The question is: how can i use two statements in a case when? I'm trying to find a way to make this select statement work. I'm writing code to see if there is contactinformation in a specific code (A01). A filter in the where clausule isn't enough because it's a joint source, I get too many results.

SELECT , (CASE WHEN ("concat"("abs"."waarneming_waarnsrt_code", "abs"."waarneming_waarnsrtreden_code") = ('A01') AND ("abs"."contact_contactsrtcode_telnr_telnrsms_emailadres" like '%@%') then 'email/telefoon in voormelding' end) emailtelefoon , (CASE WHEN ("concat"("abs"."waarneming_waarnsrt_code", "abs"."waarneming_waarnsrtreden_code") = ('A01') AND ("abs"."contact_contactsrtcode_telnr_telnrsms_emailadres" like '!%@%') then 'geen email/telefoon in voormelding' end) emailtelefoon

FROM "abs" INNER JOIN "c"nrs" "nrs" ON ("nrs"."barcd" = "abs"."barcd")

WHERE (("concat"("abs"."waarneming_waarnsrt_code", "abs"."waarneming_waarnsrtreden_code") = ('A01')) AND ("nrs"."year" = '2022') AND ("nrs"."collodata_product_productoptie_kenmsrtcode_optiesrtcode" LIKE '%021;020%') AND ("concat"("nrs"."waarneming_waarnsrt_code", "nrs"."waarneming_waarnsrtreden_code") = ('J23')) AND "week"("nrs"."waarneming_waarndt") > 17)

Group by 1,2 ORDER BY 1 ASC ;

已提问 2 年前224 查看次数
1 回答
0
已接受的回答

As far as I understood, your requirement is to use more than one condition in case when. I have tested on my account and I was able to observe that we can use multiple boolean statements with CASE WHEN. Therefore, as far as I know, the query that you mentioned must be working fine without any troubles. I would like to know more details about your issue. Is it that the query is failing with any error? If yes, please share the error message. Else, what boolean statements you would like to convert into CASE WHEN?

These links - might probably be helpful:

If you require in depth analysis and help with respect to this issue then I would suggest you to raise a support case with AWS premium support team.

profile pictureAWS
支持工程师
Chaitu
已回答 2 年前
AWS
专家
已审核 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则