Re: [GENERAL] retrieving last 3 rows

From: "Aaron J(dot) Seigo" <aaron(at)gtv(dot)ca>
To: soundar rajan <psrajan(at)yahoo(dot)com>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] retrieving last 3 rows
Date: 1999-10-25 17:23:19
Message-ID: 99102511270801.00882@stilborne
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jacob Christen 1999-10-25 18:13:46 Re: [INTERFACES] Re: LIKE clause
Previous Message E.E. Mellor 1999-10-25 16:57:53 Re: [INTERFACES] Re: LIKE clause