cancel
Showing results for 
Search instead for 
Did you mean: 

update values based on one condition

Former Member
0 Kudos
64

Hi All,

Here is my requirement.

COLUMN1COLUMN2EXPECTED RESULT COLUMN
1XXMEN
1YXMEN
1YXMEN
2YNULL
2YNULL
3YXMEN
3YXMEN
3XXMEN
3XXMEN

In column2 if any records contains X value then for related records should populate as xmen.

key 1 has 3 values and it contains x, so expected result of all three should be xmen.

How can I achieve this result.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187605
Active Contributor
0 Kudos

In Query_1, group by COLUMN1 and map COLUMN2 to min(COLUMN2).

In Query_2, do not map COLUMN2 to output, map COLUMN3 to decode(COLUMN2='X';'XMEN',null).

In Query_3, join source table to Query_2 output on COLUMN1.