I have a table like this
id | a | b | c | status
---+---+---+---+--------
1 | 3 |12 |6 | b
2 | 5 |8 |56 | c
3 | 99|7 |23 | a
I would like to detect which column has the greatest value (1,2 or 3) and then record the “status” of that row highest value (I used a,b,c just for the example)
How could I do this?
Thanks!
See it working online: sqlfiddle
Rewritten as an
UPDATEstatement: