Home > Database > Mysql Tutorial > body text

Oracle用with语句查询第N到第M条记录

WBOY
Release: 2016-06-07 17:06:34
Original
894 people have browsed it

我们经常要访问数据集的某一个中间部分,例如第10到第20条记录,Oracle中有一个很好语句来实现,那就是with。以下是使用的例子:

我们经常要访问数据集的某一个中间部分,例如第10到第20条记录,,Oracle中有一个很好语句来实现,那就是with。以下是使用的例子:

with partdata as (select rownum rowno,t.* from  table1 t where t.id>200407160000)

select * from partdata where rowno between 10 and 20

当然还有别的方法,但我目前测试这种方法的速度最快。以上代码在Oracle 9i中测试通过。

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!