Leetcode 618. 学生地理信息报告(分组行转列)

2021-05-06 16:36:25 浏览数 (1)

代码语言:javascript复制
select 
    min(case when continent='America' then name end) America,
    min(case when continent='Asia' then name end)Asia,
    min(case when continent='Europe' then name end)Europe
    from(
        select *,row_number() over(partition by continent order by name ) r
        from student
    )A
    group by r

0 人点赞