pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: omid omoomi <oomoomi@hotmail.com>
To: bhuvansql@yahoo.com
To: pgsql-sql@postgresql.org
Subject: Re: Getting 'n-1'th record.
Date: Tue, 21 Aug 2001 09:14:10
Message-ID: <F151GQvnbEG10Gai4om0000bf5c@hotmail.com> (raw)

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@yahoo.com>
>To: pgsql-sql@postgresql.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




view thread (5+ messages)  latest in thread

Message-ID: <F151GQvnbEG10Gai4om0000bf5c@hotmail.com>
Permalink:  ../F151GQvnbEG10Gai4om0000bf5c@hotmail.com/
Also on:    postgresql.org/message-id/F151GQvnbEG10Gai4om0000bf5c@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oomoomi@hotmail.com, bhuvansql@yahoo.com
  Subject: Re: Getting 'n-1'th record.
  In-Reply-To: <F151GQvnbEG10Gai4om0000bf5c@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox