如下表中有A,B,C三列,用SQL语句实现:

当A列大于B列是选择A列,否则选择B列,当B列大于C列是选择B列,否则选择C列。

drop table numb
create table numb(
    A number,
    B number,
    C number
);

参考解答

select 
  case 
    when a>b then a 
    else 
      case
        when b>c then b 
        else c 
      end 
  end as result
from numb;

results matching ""

    No results matching ""