Home > Database > Mysql Tutorial > body text

SQLSERVER中FIRST_VALUE和LAST_VALUE

WBOY
Release: 2016-06-07 16:20:30
Original
1250 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!