当前位置:首页 > PHP教程 > PHP总结归纳

SQLSERVER中FIRST_VALUE和LAST_VALUE

with test as ( select '乐可乐可的部落格' as name,10 as score union all select '乐可乐可的部落格',15 union all select '乐可乐可的部落格',20 union all select '微软认证',30 union all select '微软认证',40 union all select '微软认证',40 ) selec

with test

as

(

select '乐可乐可的部落格' as name,10 as score

union all

select '乐可乐可的部落格',15

union all

select '乐可乐可的部落格',20

union all

select '微软认证',30

union all

select '微软认证',40

union all

select '微软认证',40

)

select name,score

,first_value(score)over(order by name) as fst

,last_value(score)over(order by name) as lst

from test

.syntaxhighlighter{padding-top:20px;padding-bottom:20px;}
【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!