Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have this table,
TYPE | DATE_01 | DATE_02 |
A | Type A | Type B |
B | Type A | Type B |
A | Type A | Type B |
B | Type A | Type B |
B | Type A | Type B |
B | Type A | Type B |
A | Type A | Type B |
A | Type A | Type B |
and i want to create a new column DATE_03 when if ([TYPE]="A";[DATE_01];[DATE_02])
This would result table
TYPE | DATE_01 | DATE_02 | DATE_03 |
A | Type A | Type B | Type A |
B | Type A | Type B | Type B |
A | Type A | Type B | Type A |
B | Type A | Type B | Type B |
B | Type A | Type B | Type B |
B | Type A | Type B | Type B |
A | Type A | Type B | Type A |
A | Type A | Type B | Type A |
May be this:
LOAD TYPE,
DATE_01,
DATE_02,
If(TYPE = 'A', DATE_01, DATE_02) as DATE_03
FROM source;