From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
---|---|
To: | Dennis(dot)Jiang(at)thomson(dot)com |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Does Postgresql have a similar pseudo-column "ROWNUM" as |
Date: | 2005-05-17 17:01:03 |
Message-ID: | 1116349263.22291.129.camel@state.g2switchworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php pgsql-sql |
On Thu, 2005-05-12 at 14:07, Dennis(dot)Jiang(at)thomson(dot)com wrote:
> Hi:
>
> Oracle has a pseudo-column "ROWNUM" to return the sequence number in which a row was returned when selected from a table. The first row ROWNUM is 1, the second is 2, and so on.
>
> Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle? If so, we can write the following query:
>
> select *
> from (select RowNum, pg_catalog.pg_proc.*
> from pg_catalog.pg_proc) inline_view
> where RowNum between 100 and 200;
You can get a functional equivalent with a temporary sequence:
create temp sequence rownum;
select *, nextval('rownum') as rownum from sometable;
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-05-17 17:06:16 | Re: Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle? |
Previous Message | Christopher Kings-Lynne | 2005-05-14 09:02:01 | Re: Printing off the page.... |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-05-17 17:06:16 | Re: Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle? |
Previous Message | Bruno Wolff III | 2005-05-17 13:18:47 | Re: getting duplicate number is there a |