Re: How to realize ROW_NUMBER() in 8.3?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: raghu ram <raghuchennuru(at)gmail(dot)com>
Cc: emilu(at)encs(dot)concordia(dot)ca, pgsql-general(at)postgresql(dot)org
Subject: Re: How to realize ROW_NUMBER() in 8.3?
Date: 2011-04-21 17:58:54
Message-ID: 20110421175853.GA9061@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 20, 2011 at 09:27:18PM +0530, raghu ram wrote:
> On Wed, Apr 20, 2011 at 9:21 PM, Emi Lu <emilu(at)encs(dot)concordia(dot)ca> wrote:
>
> > Hello,
> >
> > ROW_NUMBER() is only ready in 8.4. For 8.3, is there a simple way to get
> > row_number
> >
> > select row_number(), col1, col2...
> > FROM tableName
> >
> >
>
> Below link will demonstrates ROW_NUMBER features in pre Postgresql-8.4::
>
> http://www.postgresonline.com/journal/archives/79-Simulating-Row-Number-in-PostgreSQL-Pre-8.4.html

another approach:

http://www.depesz.com/index.php/2007/08/17/rownum-anyone-cumulative-sum-in-one-query/

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2011-04-21 18:03:55 Re: problem with parent/child table and FKs
Previous Message Alban Hertroys 2011-04-21 17:15:38 Re: problem with parent/child table and FKs