解决方案 »
- Oracle10g如何查看是否打了某个补丁?
- 讨论,讨论!如何优化这个SQL语句,高手请进
- 求一个start with ... connect by 层次查询的用法,比较完整的实例以及测试数据,谢谢了!
- 关于C#。NET的成绩名次问题???急...请各位帮忙..............
- ORA-12154: TNS: 无法解析指定的连接标识符
- 刚学oracle,问几个简单的问题!
- 程序包中的游标问题
- 请教一个oracle相关的问题
- 请介绍下数据库巨量数据时的分区和分表的区别。
- 怎么把ORACLE中的表全部导入到acces表中?
- occi 创建CreateStatement卡死
- Oracle关于同时查询某列最大值最小值的问题
--构造三个表数据
with tab1 as
(select 201406001 code, 836.00 c1
from dual
union all
select 201406001, 0.00
from dual),
tab2 as
(select 201406001 code, '现金' c4, 36.00 c5
from dual
union all
select 201406001, '银联', 800.00
from dual),
tab3 as
(select 201406001 code, '足浴' c6, 180 c7
from dual
union all
select 201406001, '按摩', 380
from dual
union all
select 201406001, '桑拿', 276
from dual)
--查询sql
select t1.code, t1.c1, t2.c4, t2.c5, t3.c6, t3.c7
from (select code, c1, row_number() over(partition by code order by c1) rn
from tab1) t1
full join (select code,
c4,
c5,
row_number() over(partition by code order by c5) rn
from tab2) t2
on t1.code = t2.code
and t1.rn = t2.rn
full join (select code,
c6,
c7,
row_number() over(partition by code order by c7) rn
from tab3) t3
on t1.code = t3.code
and t1.rn = t3.rn
查询结果