Обсуждение: selection limit

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

selection limit

От
"cristi"
Дата:
In this moment I can make a selection of the first (or last) 10 records from
a table.
select * from table_name limit 10;
I want to make a selection of the next 10 records (from 10 to 20 or from 50
to 60) from a table.

How can I do that?



Re: selection limit

От
"Muhyiddin A.M Hayat"
Дата:
----- Original Message -----
From: "cristi" <cristi@dmhi.ct.ro>
To: <pgsql-novice@postgresql.org>
Sent: Saturday, October 25, 2003 1:29 PM
Subject: [NOVICE] selection limit


> In this moment I can make a selection of the first (or last) 10 records
from
> a table.
> select * from table_name limit 10;
> I want to make a selection of the next 10 records (from 10 to 20 or from
50
> to 60) from a table.
>
> How can I do that?

select * from table_name limit 10  OFFSET 10;
select * from table_name limit 10  OFFSET 50;



Re: selection limit

От
"Anis W. Nugroho"
Дата:
Remember to use ORDER BY clause if you use LIMIT or OFFSET,
since the order of tuples PostgreSQL returns are unpredictable
unless you use ORDER BY clause.

Cheers,
Anis WN
________________________________
15 Mbytes Free Web-based and  POP3
Sign up now: http://www.gawab.com