日期:2014-05-17 浏览次数:20821 次
select rownum rn,t.* from (select * from dml.cases order by num desc) t where t.num=10;
------解决方案--------------------
不能用rownum,因为rownum必须包含rownum=1的值,否则取不到
可以用分析函数row_number()帮你解决问题
------解决方案--------------------
--第10个数据 SELECT * FROM (SELECT rownum rn, t.* FROM (SELECT * FROM dml.cases ORDER BY num DESC) t) WHERE rn = 10;
------解决方案--------------------
create table dml.cases(
num NUMBER primary key, --序号
name VARCHAR2(50), --案例名称
intro VARCHAR2(100), --案例简介
);
再补充个问题啊,就是要查按num 降序排列第十个数据怎么写,谢谢
1 select count(*) from dml.cases where num>10;
2 补充问题:select * from dml.cases where rowid=10 order by dese;
------解决方案--------------------
1 select count(*)+1 from dml.cases where num>10;
2 补充问题:select * from dml.cases where rowid=10 order by dese;