Re: getting the ranks of items

From: Harald Fuchs <use_reply_to(at)protecting(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: getting the ranks of items
Date: 2005-05-04 11:22:09
Message-ID: pu3bt35j8e.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <427821D7(dot)7070302(at)sysmaster(dot)com>,
Lyubomir Petrov <lpetrov(at)sysmaster(dot)com> writes:

> create sequence seq_tmp;
> select nextval('seq_tmp') as rank, a.id, a.name from (select id, name
> from t order by name desc) a;
> drop sequence seq_tmp;

Using a temporary sequence for that would avoid naming conflicts.

> P.S. I'm sure you can wrap it in plperl stored procedure :)

Yes, prepending the ranking column in the application would be more efficient.
I wonder whether Randall knows Perl? ;-)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2005-05-04 11:29:49 Re: getting the ranks of items
Previous Message Michelle Konzack 2005-05-04 11:08:04 Re: Rekall for Debian ?