Re: fetching rows
От | Decio Fonini |
---|---|
Тема | Re: fetching rows |
Дата | |
Msg-id | Pine.LNX.4.21.0010311043490.4283-100000@sol.ipanema.candidomendes.br обсуждение исходный текст |
Ответ на | fetching rows ("Nikolay Mijaylov" <nmmm@nmmm.nu>) |
Список | 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 (HREF="myform.php?mycounter=50"). 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: > > BEGIN WORK; > DECLARE liahona CURSOR FOR SELECT * FROM films; > FETCH [FORWARD] 25 IN liahona; > CLOSE liahona; > COMMIT WORK; > > 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.
В списке pgsql-sql по дате отправления: