Skip site navigation (1) Skip section navigation (2)

Re: fetching rows

From: Decio Fonini <fonini(at)candidomendes(dot)br>
To: Nikolay Mijaylov <nmmm(at)nmmm(dot)nu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: fetching rows
Date: 2000-10-31 12:54:24
Message-ID: (view raw or whole thread)
Lists: pgsql-sql
Hello, Nikolay,

Don't use cursors; instead, use:
" select * from films limit 25 offset 0 ; "

and on the next query:
" select * from films limit 50 offset 25 ; " 

and so on. You have to encode the current offset into the NEXT link,
either making it into a button inside a form, with a hidden field
containing the offset, or making it an HREF with URL-encoded data

I don't remember in which version the LIMIT option appeared; if your
version doesn't support it, move on to 7.0.2!

Have fun!

On Mon, 30 Oct 2000, Nikolay Mijaylov wrote:

> Let say we have a select that returns 100 rows.
> I can fetch first 25 with simple sql:
> FETCH [FORWARD] 25 IN liahona;
> CLOSE liahona;
> but how I can fetch rows from 26 to 50? I mean withou fetching first 25. Or
> can I skip first 25?
> When i ask this you need to know that Im using PHP in web environment and
> try do this to get more  performens from the script (now the script fetch
> all rows, then jump to needed row)

Fight for a free world: no walls, no windows, no gates.

In response to

pgsql-sql by date

Next:From: Najm HashmiDate: 2000-10-31 15:39:31
Subject: Need help! parse erro
Previous:From: Kovacs Zoltan SandorDate: 2000-10-31 11:30:55
Subject: PLPGSQL examples

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group