- please find the table-A structure below:
ID x y z Info
---------------------------
1 1 1 0 dog
1 0 1 0 cat
1 1 1 1 rat
1 0 1 1 mouse
1 0 0 0 none
2 1 1 1 green
2 0 1 0 yellow
2 0 0 0 red
3 0 1 1 sun
3 1 1 0 mon
4 0 1 1 kill
Required logic :
above table needs to be group by using ID column &
Step-1: if x=1, y=1 and z=0 then take info value, else go to step-2
Step-2: if x=0, y=1 and z=0 then take info value, else go to step-3
Step-3: Other than above steps, we need to put null as info value
and required output mentioned in below
ID Info
----------------------
1 dog
2 yellow
3 mon
4 Null