with t1 as ( select 'A' f1, 1 f2, 2 f3 from dual union all select 'B' f1, 2 f2, 4 f3 from dual ) select t1.f1, case when t2.f1 = 'F2' then t1.f2 when t2.f1 = 'F3' then t1.f3 else null end from t1, (select 'F2' f1 from dual union all select 'F3' f1 from dual) t2
with t1 as ( select 'A' f1, 1 f2, 2 f3 from dual union all select 'B' f1, 2 f2, 4 f3 from dual ) select t1.f1,t2.f1 f3, case when t2.f1 = 'F2' then t1.f2 when t2.f1 = 'F3' then t1.f3 else null end from t1, (select 'F2' f1 from dual union all select 'F3' f1 from dual) t2
select f1, 'f2', f2 from t1
union allselect f1, 'f3', f3 from t1--order by ...按什么排序,自已加上就行
(
select 'A' f1, 1 f2, 2 f3 from dual
union all
select 'B' f1, 2 f2, 4 f3 from dual
)
select t1.f1,
case when t2.f1 = 'F2' then t1.f2
when t2.f1 = 'F3' then t1.f3 else null end
from t1,
(select 'F2' f1 from dual
union all
select 'F3' f1 from dual) t2
(
select 'A' f1, 1 f2, 2 f3 from dual
union all
select 'B' f1, 2 f2, 4 f3 from dual
)
select t1.f1,t2.f1 f3,
case when t2.f1 = 'F2' then t1.f2
when t2.f1 = 'F3' then t1.f3 else null end
from t1,
(select 'F2' f1 from dual
union all
select 'F3' f1 from dual) t2
from t1
union allselect f1, 'f3', f3
from t1--order by ...按什么排序,自已加上就行