Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7LELhP19343 for ; Tue, 21 Aug 2001 10:21:43 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f7LELbY29405; Tue, 21 Aug 2001 10:21:37 -0400 (EDT) To: Bhuvan A cc: pgsql-sql@postgresql.org Subject: Re: Getting 'n-1'th record. In-reply-to: References: Comments: In-reply-to Bhuvan A message dated "Tue, 21 Aug 2001 13:11:33 +0530" Date: Tue, 21 Aug 2001 10:21:37 -0400 Message-ID: <29402.998403697@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/267 X-Sequence-Number: 4514 Bhuvan A writes: > I need ONLY the 'n-1'th record. See the 'LIMIT' and 'OFFSET' clauses in SELECT. Note the caveat that you'd better ORDER the rows to be sure you know which is the n-1'th. Having done an ORDER BY, you could simplify your life by reversing the ordering and choosing the second row (OFFSET 1 LIMIT 1). regards, tom lane