Skip to main content

Hi

Is it possible to create a custom field that looks up the param_id field in Variable Data and populates with another value. I can create what I am after in Excel using this IFS statement IF(param_id = "A050-H","103"), but how would I write that in sql for a custom field in IFS?

Thanks,

Hayley

Think what you are after is a CASE statement

SELECT CASE WHEN ‘Value’ = ‘Condition’ THEN ‘Outcome’ END

FROM VIEW

 

e.g.

SELECT CASE WHEN param_id = ‘A050-H’ THEN ‘103’ END

FROM CUSTOMER

 

You can extend a case statement with multiple conditions. Also escape it with ‘ELSE’ 

CASE

WHEN… THEN ..

WHEN... THEN ..

ELSE …

END


Reply