Re: SELECT * FROM foo OFFSET -1 LIMIT 1

Поиск
Список
Период
Сортировка
От Martín Marqués
Тема Re: SELECT * FROM foo OFFSET -1 LIMIT 1
Дата
Msg-id 200506271417.28851.martin@bugs.unl.edu.ar
обсуждение исходный текст
Ответ на SELECT * FROM foo OFFSET -1 LIMIT 1  (Markus Bertheau ☭ <twanger@bluetwanger.de>)
Ответы Re: SELECT * FROM foo OFFSET -1 LIMIT 1
Список 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 по дате отправления:

Предыдущее
От: davide
Дата:
Сообщение: Re: How can I simply substatue a value in a query?
Следующее
От: Markus Bertheau
Дата:
Сообщение: Re: SELECT * FROM foo OFFSET -1 LIMIT 1