what i have
id s_1 s_2 s_3 s_4 s_5 s_6 s_7 s_8
ax 1 0 0 0 0 0 0 0
bx 0 1 0 0 0 0 0 0
cx 0 0 1 0 0 0 0 0
dx 0 0 0 1 0 0 0 0
ex 0 0 0 0 1 0 0 0
fx 0 0 0 0 0 1 0 0
gx 0 0 0 0 0 0 1 0
hx 0 0 0 0 0 0 0 1
I am trying to update my column values as below .
if i have 1,0,0,0,0,0,0,0, as column values from s1 to s8 then it should be updated as 1,0,1,0,1,0,1,0
if i have 0,1,0,0,0,0,0,0 as column values from s1 to s8 then it should be updated as 0,1,1,0,1,0,1,0
if i have 0,0,1,0,0,0,0,0 as column values from s1 to s8 then it should be updated as 0,0,1,0,1,0,1,0
if i have 0,0,0,1,0,0,0,0 as column values from s1 to s8 then it should be updated as 0,0,0,1,1,0,1,0
if i have 0,0,0,0,1,0,0,0, as column values from s1 to s8 then it should be updated as 0,0,0,0,1,0,1,0
if i have 0,0,0,0,0,1,0,0 as column values from s1 to s8 then it should be updated as 0,0,0,0,1,1,1,0
if i have 0,0,0,0,0,0,1,0, as column values from s1 to s8 then it should be updated as 0,0,0,0,0,0,1,0
if i have 0,0,0,0,0,0,0,1 as column values from s1 to s8 then it should be updated as 0,0,0,0,0,0,0,1
Output looks like below
id s_1 s_2 s_3 s_4 s_5 s_6 s_7 s_8
ax 1 0 1 0 1 0 1 0
bx 0 1 1 0 1 0 1 0
cx 0 0 1 0 1 0 1 0
dx 0 0 0 1 1 0 1 0
ex 0 0 0 0 1 0 1 0
fx 0 0 0 0 1 1 1 0
gx 0 0 0 0 0 0 1 0
hx 0 0 0 0 0 0 0 1
postgresqltag if you are using Greenplum