地址 https://leetcode-cn.com/problems/students-report-by-geography/
select
b.name 'America'
,c.name 'Asia'
,d.name 'Europe'
from(
select distinct row_number() over(partition by continent order by name)id
from student
order by name
)a left join (
select name,row_number() over(partition by continent order by name)id
from student where continent='America'
)b on a.id=b.id left join(
select name,row_number() over(partition by continent order by name)id
from student where continent='Asia'
)c on a.id=c.id left join(
select name,row_number() over(partition by continent order by name)id
from student where continent='Europe'
)d on a.id=d.id
网友评论