X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFAC652A57 for ; Mon, 21 Mar 2005 07:08:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80253-01 for ; Mon, 21 Mar 2005 07:08:13 +0000 (GMT) Received: from vvamail.satyam.com (vvamail.satyam.com [208.220.247.17]) by svr1.postgresql.org (Postfix) with ESMTP id 85F5A5646E for ; Mon, 21 Mar 2005 07:08:12 +0000 (GMT) Received: from che1.satyam.com (che1.satyam.com [172.18.73.11]) by vvamail.satyam.com (8.11.6/8.11.6) with ESMTP id j2L6mbR04272 for ; Mon, 21 Mar 2005 01:48:38 -0500 Received: from cscmsg002.corp.satyam.ad (localhost [127.0.0.1]) by che1.satyam.com (8.11.6/8.11.6) with ESMTP id j2L72pU00951 for ; Mon, 21 Mar 2005 12:32:51 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C52DE4.BA4D431D" Subject: equivalent of oracle rank() in postgres Date: Mon, 21 Mar 2005 12:38:05 +0530 Message-ID: <2EB549AAAFEA264FA926269A5BD5E9EB14657F@certsrv.satyam.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: equivalent of oracle rank() in postgres Thread-Index: AcUt5LCVHQ5iStuXT7WEffhI/5jnuA== From: "Chandan_Kumaraiah" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.486 tagged_above=0 required=5 tests=AWL, HTML_90_100, HTML_MESSAGE, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200503/274 X-Sequence-Number: 20753 This is a multi-part message in MIME format. ------_=_NextPart_001_01C52DE4.BA4D431D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 Hi, =20 Jus wanted the equivalent for rank() as in tis example.. =20 SELECT * FROM ( SELECT employee_id, last_name, salary, RANK() OVER (ORDER BY salary DESC) EMPRANK FROM employees) WHERE emprank =3D 3; =20 Rgds, Chandan ------_=_NextPart_001_01C52DE4.BA4D431D Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

Hi,

 

Jus wanted the equivalent for rank() as in tis = example..

 

SELECT *
FROM (
  SELECT employee_id, last_name, salary,
  RANK() OVER (ORDER BY salary DESC) EMPRANK
  FROM employees)
WHERE emprank =3D 3;

 

Rgds,

Chandan

------_=_NextPart_001_01C52DE4.BA4D431D--