日期:2014-05-17 浏览次数:20567 次
create table test (a int,b int ,c int,d int,e int)
insert into test values(10,2,2,6,null)
insert into test values(11,7,2,2,null)
insert into test values(15,2,10,3,null)
update test set e=case when b>=c and b>=d then b
when c>=b and c>=d then c
when d>=b and d>=c then d
end
select * from test
/*
10 2 2 6 6
11 7 2 2 7
15 2 10 3 10
*/