boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - Re: 用Servlet显示数据库里的数据,分页的? (答案在这里)
相关主题
数据库问题求解
如何对ORACLE的结果既分页又排序?
用Servlet显示数据库里的数据,分页的? (很实际的问题)
how to fetch the first record from a table?
To get the 2nd, 3rd, 4th largest value
请问sql这个querry怎么写
怎么用sql query 实现这个功能?
怎么用Update实现这个?
请教一个mysql 排序问题。
random sampling with replacement, how?
相关话题的讨论汇总
话题: rownum话题: select话题: line话题: what话题: firstname
进入Database版参与讨论
1 (共1页)
a*********e
发帖数: 35
1
多谢各位的指点,偶在一个newsgroup得到了一个答案,已经验证过了,
可以用应该还不错,贴出来大家看看,但是里面的实现好象没有在Oral
ce里见过. 麻烦那位帮我解释一下.
/***********
The answer is:
select "what you need" from (
select rownum line, "what you need" from "your table" )
where line between "start of subset" and "end of subset"
.....
E.g.:
select name, firstname from (
select rownum line, name, firstname from names)
where line between 10 and 20
order by name;
/***********************
B*****n
发帖数: 135
2
rownum is a psudocolumn in the result set, it will only be
incremented after a row has been actually selected (using
all the conditions except the one involving rownum
itself).
What i'm saying is that you cannot directly do a query
like this:
select "what you need" from "your table"
where rownum between 10 and 20;
because you never actully selected anything into the
result set, the rownum will never be greater than 0.
In other words, you want to select something based on the
rownum, while the ro

【在 a*********e 的大作中提到】
: 多谢各位的指点,偶在一个newsgroup得到了一个答案,已经验证过了,
: 可以用应该还不错,贴出来大家看看,但是里面的实现好象没有在Oral
: ce里见过. 麻烦那位帮我解释一下.
: /***********
: The answer is:
: select "what you need" from (
: select rownum line, "what you need" from "your table" )
: where line between "start of subset" and "end of subset"
: .....
: E.g.:

1 (共1页)
进入Database版参与讨论
相关主题
random sampling with replacement, how?
query 求助
奇怪的 SQL 问题
oracle pl sql recursive function
请教一下高手,包子答谢!
correlated subquery
请教关于exists在sql server中的用法
oracle和XML
MySQL数据库用户管理求助
[转载] 求教数据库的query optimization 工作的面试
相关话题的讨论汇总
话题: rownum话题: select话题: line话题: what话题: firstname