Обсуждение: LIMITS in SELECTs

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

LIMITS in SELECTs

От
Fabrice Scemama
Дата:
Hi !

Is there a way to select only a range of rows from a table, using a  command
like:

SELECT * FROM table WHERE where_statement LIMIT 50,100;



I've tried, and then read the doc, but found no information so far.

Thanks in advance.



Fabrice Scemama

Re: [GENERAL] LIMITS in SELECTs

От
dustin sallings
Дата:
On Sat, 9 Jan 1999, Fabrice Scemama wrote:

// Is there a way to select only a range of rows from a table, using a  command
// like:
//
// SELECT * FROM table WHERE where_statement LIMIT 50,100;

    That doesn't make sense in a relational database by itself since
it's not guaranteed to return any particular dataset in any particular
order.  What you want is a cursor.

// I've tried, and then read the doc, but found no information so far.
//
// Thanks in advance.
//
//
//
// Fabrice Scemama
//
//

--
Principle Member Technical Staff, beyond.com    The world is watching America,
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L______________________________________________ and America is watching TV. __


RE: [GENERAL] LIMITS in SELECTs

От
"Neil Burrows"
Дата:
Hi,

> Is there a way to select only a range of rows from a table, using
> a  command
> like:
>
> SELECT * FROM table WHERE where_statement LIMIT 50,100;

Assuming you use a "Order By" clause to make sure you got the records in the
appropriate order there is a patch file in the "patches" directory of
ftp.postgresql.org which adds the "LIMIT" command to PostgreSQL 6.4.x

I've not tried it, so cannot say how well it works, or if it can do limits
between 2 values, but you can give it a shot.

Regards,

Neil