mercredi 5 avril 2017

How can I use and IF statement within a REPLACE () statement?

got a query in regards to using an IF statement within a REPLACE statement (if it is possible!)

Example:

REPLACE("Person Legislative Information"."Marital Status",'Widowed','Widower')

So that works, but I need an IF statement in there to distinguish between whether they are a Widower or a Widow based on their gender (which can be pulled from another column).

Would I place an IF statement before starting the REPLACE statement?

Example:

REPLACE(REPLACE(IF("Worker"."Gender" = 'M')"Person Legislative Information"."Marital Status",'Widowed','Widower')IF("Worker"."Gender" = 'F')"Person Legislative Information"."Marital Status",'Widowed','Widow')

Not sure if I'm nesting this wrong but I can't seem to get this to work, any ideas?

Aucun commentaire:

Enregistrer un commentaire