Received: from hotmail.com (f151.law14.hotmail.com [64.4.21.151]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7L9ECP12310 for ; Tue, 21 Aug 2001 05:14:12 -0400 (EDT) (envelope-from oomoomi@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 21 Aug 2001 02:14:10 -0700 Received: from 213.29.16.6 by lw14fd.law14.hotmail.msn.com with HTTP; Tue, 21 Aug 2001 09:14:10 GMT X-Originating-IP: [213.29.16.6] From: "omid omoomi" To: bhuvansql@yahoo.com, pgsql-sql@postgresql.org Subject: Re: Getting 'n-1'th record. Date: Tue, 21 Aug 2001 09:14:10 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 21 Aug 2001 09:14:10.0775 (UTC) FILETIME=[A3755E70:01C12A21] X-Archive-Number: 200108/263 X-Sequence-Number: 4510 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 >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