Oracle - Select 来自 dual 的多个别名行
Oracle - Select multiple aliased rows from dual
在 Oracle 中,我想要 select 2 列多行:
示例:
name Phone
---- -----
John 1234
Mary 4321
这行不通:
select
'John' as name,
'Mary' as name,
'1234' as phone,
'4321' as phone
from
dual
合并两个单行查询:
select
'John' as name,
'1234' as phone
from
dual
union all
select
'Mary' as name,
'4321' as phone
from
dual
NAME
PHONE
John
1234
Mary
4321
在 Oracle 中,我想要 select 2 列多行:
示例:
name Phone
---- -----
John 1234
Mary 4321
这行不通:
select
'John' as name,
'Mary' as name,
'1234' as phone,
'4321' as phone
from
dual
合并两个单行查询:
select
'John' as name,
'1234' as phone
from
dual
union all
select
'Mary' as name,
'4321' as phone
from
dual
NAME | PHONE |
---|---|
John | 1234 |
Mary | 4321 |