Re: Getting 'n-1'th record.

From: "omid omoomi" <oomoomi(at)hotmail(dot)com>
To: bhuvansql(at)yahoo(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Getting 'n-1'th record.
Date: 2001-08-21 09:14:10
Message-ID: F151GQvnbEG10Gai4om0000bf5c@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
It is a not a clean job but how about having a view like this :

create view foo_view as select * from yourtable order by oid desc limit 2 ;

and then making your select like this:
select * from foo_view order by oid limit 1;

hope that helps
Omid

>From: Bhuvan A <bhuvansql(at)yahoo(dot)com>
>To: pgsql-sql(at)postgresql(dot)org
>Subject: [SQL] Getting 'n-1'th record.
>Date: Tue, 21 Aug 2001 13:11:33 +0530 (IST)
>
>
>hi all,
>
>consider below..
>
>An sql query results with 'n' records. OK.
>I need ONLY the 'n-1'th record.
>
>
>HOW CAN I GET THIS?
>
>Thankx in advance!
>
>
>======================================================================
> Q: What's the difference between the 1950's and the 1980's?
> A: In the 80's, a man walks into a drugstore and states loudly, "I'd
> like some condoms," and then, leaning over the counter, whispers,
> "and some cigarettes."
>
>
>======================================================================
>
>Regards,
>Bhuvaneswar.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Browse pgsql-sql by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2001-08-21 09:26:18 Re: Primary vs Unique Index
Previous Message Bhuvan A 2001-08-21 07:41:33 Getting 'n-1'th record.