union all里不能用order by。
sql="select * from (select * from pc_spe_info where rownum<=5 union all select * from pc_spe_info where rownum<=10) order by num"
sql="select * from (select * from pc_spe_info where rownum<=5 union all select * from pc_spe_info where rownum<=10) order by num"
解决方案 »
- union all多表联合效率太低,请高手支招
- 关于java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDriver的求助!!!!!
- ((急)) Oralce列转行难题...不是行转列 ?????????
- 请人解决问题 语法问题
- 用JDBC-ODBC连接Oracle的问题
- 求教:如何取近一个自然月平均值的sql的写法
- oracle动态sql
- 好久未解决的问题:怎样在dos下执行sql脚本文件?
- 考试将一张表的行记录拉成列记录如何用一条sql语句实现?比如:
- 64bit Sqlserver2012 链接服务器连接Oracle10g 32bit已被玩疯
- 请问能实现VC中嵌入PL/SQL,或PL/SQL中调用VC生成的DLL吗?
- 一个sql能完成这样的事吗?
select ROWNUM,COLUMN_NAME from pc_spe_info where rownum<=10 order by 1;
(1 IS ROWNUM)
(select * from pc_spe_info where rownum<=5 union all select * from pc_spe_info where rownum<=10) order by num
只要把要order by的列名写在select中就没有问题了。
SQL> select rownum,id from test2 union all select rownum,id from test2 order by
id; ROWNUM ID
---------- ----------
3 1
3 1
2 4
2 4
4 6
5 6
4 6
5 6
1 62
1 6210 rows selected.SQL> select rownum num,id from test2 union all select rownum num,id from test2 o
rder by num; NUM ID
---------- ----------
1 62
1 62
2 4
2 4
3 1
3 1
4 6
4 6
5 6
5 610 rows selected.
(select * from pc_spe_info where rownum<=5 )union all (select * from pc_spe_info where rownum<=10 order by num)不知该如何写?
(select * from pc_spe_info where rownum<=5 )union all (select * from (select * from pc_spe_info where rownum<=10 order by num);
(select * from pc_spe_info where rownum<=5 )union all (select * from (select * from pc_spe_info where rownum<=10 order by num));
ADODB.Recordset 错误 '800a0e78'
对象关闭时,不允许操作。
/ynnw/computer/index.asp,行338 行338为:while not rs.EOF
怎么回事?