0

I got some issues updating a boolean field in MC. In fact, I have 2 tables, [Journey - Prospects] and [Contacts]. On the Prospects table, I have a boolean field 'Buyer' that is false.

What I want is : If the email adress contained in the Prospect table exist in the Contacts table, then I want to update the field 'Buyer' on the Prospects table as 'true'.

Here is my SQL :

SELECT

J.[EMAIL],
CASE WHEN (C.[EMAIL] is not null) THEN J.[Buyer] as 'true'
FROM [Journey - Prospects] J

INNER JOIN [Contacts] C ON C.[EMAIL] = J.[EMAIL]

But somewhere, my syntaxe is not right, can you help me ?

Thanks for your help !

0

You are missing the END keyword.

Try:

SELECT

J.[EMAIL],
CASE WHEN (C.[EMAIL] is not null) THEN J.[Buyer] END as 'true'
FROM [Journey - Prospects] J

INNER JOIN [Contacts] C ON C.[EMAIL] = J.[EMAIL]

The syntax of the CASE is:

CASE input_expression   
     WHEN when_expression THEN result_expression [ ...n ]   
     [ ELSE else_result_expression ]   
END  
  • Thanks ! I tried your way but it still doesn't work. The syntaxe is now correct and i can run my query, but nothing happen (the FALSE field never become TRUE). I also tried the same thing with a text field (just write False and ask marketing cloud to change it to True). But still doesn't work ... – Marco Jun 20 at 14:15
0

The CASE syntax is incorrect. See here for more on SQL CASE statements.

SELECT

J.EMAIL, 
CASE WHEN C.EMAIL IS NOT NULL THEN 'true' ELSE 'false' END AS BUYER

FROM [Journey - Prospects] J

INNER JOIN [Contacts] C ON C.[EMAIL] = J.[EMAIL]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.