Re: [GENERAL] retrieving last 3 rows

Поиск
Список
Период
Сортировка
От Aaron J. Seigo
Тема Re: [GENERAL] retrieving last 3 rows
Дата
Msg-id 99102511270801.00882@stilborne
обсуждение исходный текст
Ответ на retrieving last 3 rows  (soundar rajan <psrajan@yahoo.com>)
Список pgsql-general
hi...

> In pg, I wrote the same with needed casting as,
>
> select * from T_name where int8(oid) > (select
> max(int8(oid)) from T_name) order by PK;

an easy way is to do this:

select * from T-name order by oid desc, PK limit 3;

this will not return them in PK order, but by order of writing... if PK is
incremented every record, they will appear in reverse order...

hope this helps...

--
Aaron J. Seigo
Sys Admin

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

Предыдущее
От: "E.E. Mellor"
Дата:
Сообщение: Re: [INTERFACES] Re: LIKE clause
Следующее
От: Courtney Thomas
Дата:
Сообщение: HELP: {compiling 6.5.2 on FreeBSD3.3} <-error