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 ;

feita há 2 anos224 visualizações
1 Resposta
0
Resposta aceita

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
ENGENHEIRO DE SUPORTE
Chaitu
respondido há 2 anos
AWS
ESPECIALISTA
avaliado há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas