Skip site navigation (1) Skip section navigation (2)

Re: numbering rows in a view

From: richard terry <rterry(at)pacific(dot)net(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: numbering rows in a view
Date: 2009-08-30 12:11:25
Message-ID: 200908302211.25768.rterry@pacific.net.au (view raw or flat)
Thread:
Lists: pgsql-novice
On Sunday 30 August 2009 21:53:15 Thomas Kellerer wrote:
> richard terry wrote on 30.08.2009 13:26:
> > I need a unique numbering for a view row and I can recall somewhere that
> > postgres was getting a new function which would enable this to happen,
> > I've searched the docs but I mustn't be putting in the right key words,
> > so I wondered if someone could enlighten me.
>
> You are probably looking for row_number() which was introduced in 8.4
>
> http://www.postgresql.org/docs/current/static/functions-window.html
>
> Something like:
>
> SELECT <your_column_list_here>, row_number() over ()
> FROM ...
>
> Thomas
thanks, I'll check it out.

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2009-08-30 15:55:09
Subject: Re: Triggers and Domains
Previous:From: Thomas KellererDate: 2009-08-30 11:53:15
Subject: Re: numbering rows in a view

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group