Обсуждение: Row Nums

Поиск
Список
Период
Сортировка

Row Nums

От
Anand Surelia
Дата:
Hi,
I want to display serial numbers of rows selected by a query. I can do
this in Oracle by selecting a special attribute called 'rownum' (or
'rowno'). Can I do this in Postgres too? If not then is there any
alternative in Postgres?


Thanks,
Anand.


Re: [GENERAL] Row Nums

От
tom@swing.citiscape.com
Дата:
You might mean "oid." Try selecting oid form a table.

tom

On Wed, 7 Oct 1998, Anand Surelia wrote:

> Hi,
> I want to display serial numbers of rows selected by a query. I can do
> this in Oracle by selecting a special attribute called 'rownum' (or
> 'rowno'). Can I do this in Postgres too? If not then is there any
> alternative in Postgres?
>
>
> Thanks,
> Anand.


Re: [GENERAL] Row Nums

От
"Jose' Soares"
Дата:
Anand Surelia wrote:
>
> Hi,
> I want to display serial numbers of rows selected by a query. I can do
> this in Oracle by selecting a special attribute called 'rownum' (or
> 'rowno'). Can I do this in Postgres too? If not then is there any
> alternative in Postgres?
>
SELECT oid, * FROM tablename;

Jose'

Re: [GENERAL] Row Nums

От
Anand Surelia
Дата:
Jose' Soares wrote:

> Anand Surelia wrote:
> >
> > Hi,
> > I want to display serial numbers of rows selected by a query. I can do
> > this in Oracle by selecting a special attribute called 'rownum' (or
> > 'rowno'). Can I do this in Postgres too? If not then is there any
> > alternative in Postgres?
> >
> SELECT oid, * FROM tablename;
>
> Jose'
>

No I dont't want the oids but the serial number of a row in the present
output of the query. For e.g in Oracle we have:
select rownum,name from tablename;

will give me,

rownum | name

1           | Anand
2           | Jose' Soares
3           | Someone

Thanks,
Anand.