Re: offset for query result ??

From: Alex Satrapa <alex(at)lintelsys(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: offset for query result ??
Date: 2003-11-17 23:59:22
Message-ID: 3FB960DA.6090604@lintelsys.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kathy Zhu wrote:
> I know we have LIMIT to limit the number of rows returned, I wonder if there is
> a way to indicate an offset.

> Select * from Test offset 10, limit 4;

As per the PostgreSQL documentation, specifically the page on the
"SELECT" SQL command:

LIMIT Clause

LIMIT { count | ALL }
OFFSET start

where count specifies the maximum number of rows to return, and start
specifies the number of rows to skip before starting to return rows.

so the query you want is:

SELECT * FROM Test LIMIT 4 OFFSET 10;

Alex

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Reece Hart 2003-11-18 00:09:38 Re: PostgreSQL v7.4 Released
Previous Message terry 2003-11-17 23:52:06 Re: PostgreSQL v7.4 Released