Re: Getting 'n-1'th record.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting 'n-1'th record.
Дата
Msg-id 29402.998403697@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Getting 'n-1'th record.  (Bhuvan A <bhuvansql@yahoo.com>)
Список pgsql-sql
Bhuvan A <bhuvansql@yahoo.com> writes:
> I need ONLY the 'n-1'th record.

See the 'LIMIT' and 'OFFSET' clauses in SELECT.  Note the caveat that
you'd better ORDER the rows to be sure you know which is the n-1'th.
Having done an ORDER BY, you could simplify your life by reversing
the ordering and choosing the second row (OFFSET 1 LIMIT 1).
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: database location question
Следующее
От: "Jeff Eckermann"
Дата:
Сообщение: Re: split/explode functions