[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] DB2 to Postgresql conversion help.
From:       Joe Conway <mail () joeconway ! com>
Date:       2002-12-23 17:13:45
[Download RAW message or body]

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


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic