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 по дате отправления: