Re: SELECT * FROM foo OFFSET -1 LIMIT 1 - Mailing list pgsql-sql

From Martín Marqués
Subject Re: SELECT * FROM foo OFFSET -1 LIMIT 1
Date
Msg-id 200506271417.28851.martin@bugs.unl.edu.ar
Whole thread Raw
In response to SELECT * FROM foo OFFSET -1 LIMIT 1  (Markus Bertheau ☭ <twanger@bluetwanger.de>)
Responses Re: SELECT * FROM foo OFFSET -1 LIMIT 1
List pgsql-sql
El Lun 27 Jun 2005 12:34, Markus Bertheau ☭ escribió:
> Hi,
>
> is there a reason that
>
> SELECT * FROM t1 OFFSET -1 LIMIT 1
>
> does not return 0 rows? Accordingly
>
> SELECT * FROM t1 OFFSET -1 LIMIT 2
>
> should return 1 row, imo.

From the docs:
The LIMIT clause consists of two independent sub-clauses:

LIMIT { count | ALL }
OFFSET start

count specifies the maximum number of rows to return, while start specifies
the number of rows to skip before starting to return rows. When both are
specified, start rows are skipped before starting to count the count rows to
be returned.

How do you skip -1 rows?

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués          |   Programador, DBA
Centro de Telemática    |     Administrador              Universidad Nacional                   del Litoral
---------------------------------------------------------


pgsql-sql by date:

Previous
From: davide
Date:
Subject: Re: How can I simply substatue a value in a query?
Next
From: Markus Bertheau
Date:
Subject: Re: SELECT * FROM foo OFFSET -1 LIMIT 1