表中有A B C三列,用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列
if object_Id('testTb')is not null drop table testTb
go
create table testTb (A int , B int ,C int)
insert into testTb
select 1,2,3 union all
select 1,3,2 union all
select 2,1,3 union all
select 3,1,4
select
(case when A > B then A else B end) as E,
(case when B > C then B else C end) as F
from testTb
drop table testTb
用发现的眼光来看这个互联网,总有我们立脚的地方!——北纬28.33