Received: from web302.mail.yahoo.com (web302.mail.yahoo.com [128.11.68.233]) by hub.org (8.9.3/8.9.3) with SMTP id OAA16849 for ; Mon, 10 Jan 2000 14:14:10 -0500 (EST) (envelope-from alain_tesio@yahoo.com) Received: (qmail 1988 invoked by uid 60001); 10 Jan 2000 19:14:06 -0000 Message-ID: <20000110191406.1987.qmail@web302.mail.yahoo.com> Received: from [194.2.210.177] by web302.mail.yahoo.com; Mon, 10 Jan 2000 11:14:06 PST Date: Mon, 10 Jan 2000 11:14:06 -0800 (PST) From: Alain TESIO Reply-To: tesio@easynet.fr Subject: Re: [SQL] query to do a backward 'skip', possible with (index) optimization ? To: Albert Loo Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > > => select * from mytable where id > < '12345' order by id desc limit 1; > > > - which returned the correct > result '12344', but without optimization. Just an idea : add another column negative_id which is equal to -id and reverse the test ... Alain __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com