原数据形式为
-----------------------
code in out
-----------------------
move A B
查询效果为
-----------------------
type place
-----------------------
进 A
出 B
没什么头绪,用left join or,case when搞了半天,没弄出来,
有经验的朋友麻烦给点思路哈,感激不尽~~
-----------------------
code in out
-----------------------
move A B
查询效果为
-----------------------
type place
-----------------------
进 A
出 B
没什么头绪,用left join or,case when搞了半天,没弄出来,
有经验的朋友麻烦给点思路哈,感激不尽~~
(select 'move' as code,'A' AS ins,'B' as outs from dual)
select decode(place,'A','近','B','出',null) as type,
place
from
(select ins as place from test
union all
select outs as place from test);
指定进出即可select '进' type, in place from table
union all
select '出' type, out place from table;
2 select 'move' code, 'A' ins, 'B' outs from dual)
3 select '进' type,ins place from tb union all
4 select '出' type,outs place from tb
5 /
TYPE PLACE
---- -----
进 A
出 B
with tab as
(
select 'move' code, 'A' inC, 'B' outC from dual
)
select '进' type, inC from tab union all
select '出' type, outC from tab ------------------------------------
进 A
出 B