select sysdate a, (select sysdate b, sysdate c from dual) from dual;
我想得到select a,b,c,而oracle上面这种写法报错,第二个select 只能有一个列,请问应该怎么写?
------解决方案--------------------
一次只能1列,分开写就行了
select sysdate a, (select sysdate from dual) b, (select sysdate from dual) c from dual;
------解决方案--------------------
像这种情况(在同一个表同样的筛选)应该用表连接。类似于:
with table_a(code,name,cls) as (
select 1,'name1','101' from dual
union all
select 2,'name2','101' from dual
union all
select 3,'name3','102' from dual
),
table_b(cls,name,addr) as (
select '101','cls1','road1' from dual
union all
select '102','cls2','road2' from dual
)
select a.code,a.name,b.name,b.addr
from table_a a,table_b b
where a.cls = b.cls