好像没有这样的函数,可以这样 
select max(aa.kk) 最大值 
from (select k1 as kk from 表 where 条件 union all
      select k2 as kk from 表 where 条件 union all
      select k3 as kk from 表 where 条件 union all
      select k4 as kk from 表 where 条件 union all
      select k5 as kk from 表 where 条件 ) aa

解决方案 »

  1.   

    case when k1>k2 then k1 else k2 end多重组合就是了
      

  2.   

    case when k1>=k2 and k1>=k3 and k1>=k4 and k1>=k5 then k1
         when k2>=k3 and k2>=k4 and k2>=k5 then k2
         when k3>=k4 and k3>=k5 then k3
         when k4>=k5 then k4
         else k5
    end
      

  3.   

    风云同志的最好,不过我也想练练手,写一个不同的select kk from (select max(k1) as kk from table
    union all
    select max(k2) as kk from table
    union all
    select max(k3) as kk from table
    union all
    select max(k4) as kk from table
    union all
    select max(k5) as kk from table) newtable order by kk desc