经过几个小时后,我找不到答案.
首先我的桌子
id | one | two | three | four | five | galname
-------------------------------------------------
1 | 2 | 5 | 23 | 4 | 5 | Bob
three - 23
最佳答案
select id,GREATEST(one,two,three,four,five) value,case GREATEST(one,five)
when one then 'one'
when two then 'two'
when three then 'three'
when four then 'four'
when five then 'five' end column_name
from your_table