so i added the other half of the columns and now it doesn't work properly. Now it sets every column to the highest value. Here is the edited code:
UPDATE temp SET
erg1 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg2 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg3 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg4 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg5 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg6 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg7 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg8 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg9 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end,
erg10 = case when erg1 > erg2 and erg1 > erg3 and erg1 > erg4
and erg1 > erg5 and erg1 > erg6 and erg1 > erg7
and erg1 > erg8 and erg1 > erg9 and erg1 > erg10
then erg1
when erg2 > erg1 and erg2 > erg3 and erg2 > erg4
and erg2 > erg5 and erg2 > erg6 and erg2 > erg7
and erg2 > erg8 and erg2 > erg9 and erg2 >erg10
then erg2
when erg3 > erg1 and erg3 > erg2 and erg3 > erg4
and erg3 > erg5 and erg3 > erg6 and erg3 > erg7
and erg3 > erg8 and erg3 > erg9 and erg3 >erg10
then erg3
when erg4 > erg1 and erg4 > erg2 and erg4 > erg3
and erg4 > erg5 and erg4 > erg6 and erg4 > erg7
and erg4 > erg8 and erg4 > erg9 and erg4 >erg10
then erg4
when erg5 > erg1 and erg5 > erg2 and erg5 > erg3
and erg5 > erg4 and erg5 > erg6 and erg5 > erg7
and erg5 > erg8 and erg3 > erg9 and erg3 >erg10
then erg5
when erg6 > erg1 and erg6 > erg2 and erg6 > erg3
and erg6 > erg4 and erg6 > erg5 and erg6 > erg7
and erg6 > erg8 and erg6 > erg9 and erg6 >erg10
then erg6
when erg7 > erg1 and erg7 > erg2 and erg7 > erg3
and erg7 > erg4 and erg7 > erg5 and erg7 > erg6
and erg7 > erg8 and erg7 > erg9 and erg7 >erg10
then erg7
when erg8 > erg1 and erg8 > erg2 and erg8 > erg3
and erg8 > erg4 and erg8 > erg5 and erg8 > erg6
and erg8 > erg7 and erg8 > erg9 and erg8 >erg10
then erg8
when erg9 > erg1 and erg9 > erg2 and erg9 > erg3
and erg9 > erg4 and erg9 > erg5 and erg9 > erg6
and erg9 > erg7 and erg9 > erg8 and erg9 >erg10
then erg9 else erg10 end