Re: newbie question for return date

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: newbie question for return date
Дата
Msg-id 22753.1035915884@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: newbie question for return date  (Medi Montaseri <medi.montaseri@intransa.com>)
Список pgsql-general
Medi Montaseri <medi.montaseri@intransa.com> writes:
> Hey a suggestion, what if PG would support the negative limit as in
> select * from table limit -1 to mean limit it from the other end of
> list.....

You'd hardly want that, as it would necessarily be the slowest possible
way of retrieving the rows you're after.

Instead, reverse the sort order.  For example

    select * from table order by datecol desc limit 1;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: command-line history (readline) fails
Следующее
От: Neil Conway
Дата:
Сообщение: Re: EXPLAIN times