Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9A43C476403 for ; Mon, 23 Dec 2002 12:16:00 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id DF22F475E8C for ; Mon, 23 Dec 2002 12:15:21 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.2) with ESMTP-TLS id 1492163; Mon, 23 Dec 2002 09:55:04 -0800 Message-ID: <3E074449.9060608@joeconway.com> Date: Mon, 23 Dec 2002 09:13:45 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Pauley Cc: pgsql-sql@postgresql.org Subject: Re: DB2 to Postgresql conversion help. References: <20021223163201.37261.qmail@web13406.mail.yahoo.com> In-Reply-To: <20021223163201.37261.qmail@web13406.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/264 X-Sequence-Number: 10852 John Pauley wrote: > All, Any suggestions on a Postgresql equivalent to > the following DB2 sql query: > > SELECT * FROM (SELECT > ID,NAME,CITY,STATE,PROGRAM,CUST_NAME,CUST_ID,ROWNUMBER() > OVER (ORDER BY ID ASC) AS RN FROM > MERCHANT_BROWSER_VIEW WHERE CUST_ID = 'A51B8CA2' ) AS > RESULT WHERE RN BETWEEN 1 AND 20 > I'm not familiar with DB2, but I'd guess something like: SELECT ID,NAME,CITY,STATE,PROGRAM,CUST_NAME,CUST_ID FROM MERCHANT_BROWSER_VIEW WHERE CUST_ID = 'A51B8CA2' ORDER BY ID LIMIT 20; HTH, Joe