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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠