_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › T-sqlGreatest豌危蠍
|
|
microsoft sql server greatest 螳 .
蠏碁 朱朱 dummy 企螻 cross join伎 max襯 豺 蠍磯(=蠍磯1) . 蠏碁磯, 蠍磯 譬 蠏谿. 蠏谿 蠍 れ 蠍磯(=蠍磯2) 螳. 一危
create table #temp( col1 int , col2 int , col3 int , col4 int , col5 int ) insert #temp values(1,2,3,4,5) 蠍磯1
select max( case when b.col = 1 then col1 when b.col = 2 then col2 when b.col = 3 then col3 when b.col = 4 then col4 when b.col = 5 then col5 end ) max_value from #temp a cross join (values (1),(2),(3),(4),(5)) b (col) 蠍磯2
select max(b.col) max_value from #temp a cross apply (values (a.col1),(a.col2),(a.col3),(a.col4),(a.col5)) b (col) 蠍磯1覲企 蠍磯2螳 譬 ?
鏤
|
苦 覓 覓語 螳螻 讌 企 語企 蟆所鍵 碁 企. (覯 覦) |