我有一个国家/地区列表
SELECT * FROM COUNTRIES
COUNTRY
--------------
Austria
Belarus
Belgium
Finland
France
Iceland
Ireland
Switzerland
我如何将其选择为 2 列,例如
COLUMN1 COLUMN2
------- -------
Austria Belarus
Belgium Finland
France Iceland
Ireland Switzerland
谢谢。
最佳答案
select country, next_country
from
(select country,
lead(country) over (order by country) next_country,
row_number() over (order by country) rnk
from countries
)
where mod(rnk,2)=1;
关于sql - 使用 Oracle 9i 将单个文本列列表转换为 2 列列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15293354/