Skip to content
Advertisement

SQL fill empty values in a column based on case when selection

So basically what I want to achieve is that if four columns are empty, one column contains a 1 as value and one column contains 0, then I want to entries in one column meeting the conditions with a default value (0.06077).

Meaning: IF COL_A, COL_B, COL_C, COL_D IS NULL and COL_E = 0 AND COL_F = 0 then fill the rows in COL_A which meet these conditions with a default value of 0.06077.

I tried the following:

The following did fill the entries meeting my set conditions. Anyone knows a potential sollution?

Advertisement

Answer

IF COL_A, COL_B, COL_C, COL_D IS NULL and COL_E = 0 AND COL_F = 0 then fill the rows in COL_A which meet these conditions with a default value of 0.06077.

You probably needs this case expression:

Example

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement