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 ;

preguntada hace 2 años224 visualizaciones
1 Respuesta
0
Respuesta aceptada

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
INGENIERO DE SOPORTE
Chaitu
respondido hace 2 años
AWS
EXPERTO
revisado hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas