dimanche 29 septembre 2019

reproducing an Excel IF statement in Postgresql

I have a table that has the following column headers: customer id, Stage1, Stage2, Stage3 xxxxxx, 21-01-2019, 22-01-2019, 23-01-2019 yyyyyy, 22-02-2019, , 24-02-2019

I want to create a forth column, Stage 2 New, that if the relevant cell in Stage 2 is blank, assigns the date in Stage 1, in excel it will be: IF(C3=" ", B3, C3).

What is the SQL code I can use to achieve this?

Many thanks in dvance!

Aucun commentaire:

Enregistrer un commentaire