From: | "Martin Knipper" <martin(at)mk-os(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Rank |
Date: | 2004-05-04 13:42:21 |
Message-ID: | 16616.195.212.29.187.1083678141.squirrel@webmail.mk-os.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hey,
Muhyiddin A.M Hayat sagte:
>
> Dear All,
>
> I Have below table
>
> id | site_name | point
> ----+-----------+-------
> 1 | Site A | 40
> 2 | Site B | 90
> 3 | Site D | 22
> 4 | Site X | 98
>
> Would like to calc that Rank for each site, and look like
>
>
>
> id | site_name | point | rank
> ----+-----------+-------+------
> 1 | Site A | 40 | 3
> 2 | Site B | 90 | 2
> 3 | Site D | 22 | 4
> 4 | Site X | 98 | 1
>
> What can I do to get result like that
create temporary sequence ranking;
select *,nextval('ranking') as rank from yourTable order by site_name asc;
Greetins,
Martin Knipper
--
Martin Knipper
knipper(at)mk-os(dot)de
http://www.mk-os.de
From | Date | Subject | |
---|---|---|---|
Next Message | george young | 2004-05-04 14:11:19 | Re: Rank |
Previous Message | ashok@kalculate.com | 2004-05-04 13:35:31 | typecasting numeric(18,4) to varchar/text |