Obtaining a limited number of records from a long query

Поиск
Список
Период
Сортировка
Искать

Obtaining a limited number of records from a long query

От:
"Oliveiros Cristina" <oliveiros.cristina@marktest.pt>
Дата:
Dear List,
 
Is there any way to force a query to return just a few records?
 
For ex, returning just the first ten rows from a long ORDER BY query ?
 
And then, eventually, obtaining the remaining records at a later time, or in background?
 
Thanks in advance for your help,
 
Best,
Oliveiros

Re: Obtaining a limited number of records from a long query

От:
Luiz Eduardo Cantanhede Neri <lecneri@gmail.com>
Дата:
Visit http://www.sqlzoo.net/howto/source/z.dir/tip915069/postgres and u'll get ur awnser and others like from 11th and on.

For now you may try SELECT * FROM cia LIMIT 10

On Mon, May 25, 2009 at 10:32 AM, Oliveiros Cristina <oliveiros.cristina@marktest.pt> wrote:
Dear List,
 
Is there any way to force a query to return just a few records?
 
For ex, returning just the first ten rows from a long ORDER BY query ?
 
And then, eventually, obtaining the remaining records at a later time, or in background?
 
Thanks in advance for your help,
 
Best,
Oliveiros

Re: Obtaining a limited number of records from a long query

От:
Daniel Staal <DStaal@usa.net>
Дата:
--As of May 25, 2009 2:32:14 PM +0100, Oliveiros Cristina is alleged to 
have said:

> Is there any way to force a query to return just a few records?
>
> For ex, returning just the first ten rows from a long ORDER BY query ?
>
> And then, eventually, obtaining the remaining records at a later time, or
> in background?
>
> Thanks in advance for your help,

--As for the rest, it is mine.

Depending on what you want, either LIMIT and OFFSET or a cursor will help 
you.




Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
FAQ