字段
A B
A1 B1
A2 B2
A3 B3A,B数据变成
A1
B1
A2
B2
A3
B3
A B
A1 B1
A2 B2
A3 B3A,B数据变成
A1
B1
A2
B2
A3
B3
解决方案 »
- 如何优化此sql语句
- 关于64位windows 2008 操作系统下的oracle11g导出的DMP文件在 XP系统中oracle10g无法导入的问题
- 用户_表名和 用户.表名的区别。
- oracle问题
- 怎样将Oracle中的数据导出为sql脚本,急~~
- 一条sql语句可以同时插入,删除两张表的数据么,怎么写(不用触发器,存储过程)
- Oracle 10g 里面能不能取存储过程的参数以及类别.
- 不同版本ORACLE的导入,急救!!
- 为什么我在在ORCALE 里不可以用以用事务处理
- (Tuning the Shared Pool Reserved Space)翻译一句话
- 2个sql为什么效率差这么多呢?
- 高难度SQL请教
union
select B from T
union all
select B from T
SELECT *
FROM (SELECT a
FROM tt
UNION ALL
SELECT b FROM tt)
ORDER BY REVERSE(a);
with temp as(
select 'A1' A,'B1' B from dual
union all
select 'A2' A,'B2' B from dual
union all
select 'A3' A,'B3' B from dual
)
select * from(
select A from temp
union all
select B from temp
) order by reverse(a);
----
A1
A2
A3
B1
B2
B3123的排序不是楼主想要的。to--5楼
with temp as(
select 'A1' A,'B1' B from dual
union all
select 'A2' A,'B2' B from dual
union all
select 'A3' A,'B3' B from dual
)
select col from(
select A col,rownum rn from temp
union all
select B col,rownum+0.5 rn from temp
) order by rn;
要是排列成这样子呢
B1 A1 B2 A2 B3 A3
如果是
字段
A B
A3 B3
A2 B2
A1 B1
reverse 不能达到要求。还是支持9楼这种变通的方法
union
select 2 seq, B from T
order by 2,1;