Re: Last x records

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Last x records
Дата
Msg-id 003301c0a0b8$57984f00$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на Last x records  (Matthias Teege <matthias@mteege.de>)
Ответы Re: Last x records  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
From: "Matthias Teege" <matthias@mteege.de>

> Moin,
>
> is there any way to get the last x records of an query
> result?
>
> I can use "... order by x DESC LIMIT n" but I need ASC not
> DESC, the last records in the correct order.

If you know how many records there are you could use "LIMIT n OFFSET m"
where m = number of records - n

Otherwise, the only thing that I can think of is to set up a view that does
the LIMIT n on a DESC then sort ASC when selecting on that view - might
work.

- Richard Huxton


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

Предыдущее
От: brichard@cafod.org.uk (Bruce Richardson)
Дата:
Сообщение: Re: Problems with RAISE EXCEPTION
Следующее
От: "Mark, Terry"
Дата:
Сообщение: RE: copying tables