Row Nums

Started by Anand Sureliaover 27 years ago5 messagesgeneral
Jump to latest
#1Anand Surelia
anand@bytekinc.com

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.

#2Noname
tom@swing.citiscape.com
In reply to: Anand Surelia (#1)
Re: [GENERAL] Row Nums

You might mean "oid." Try selecting oid form a table.

tom

On Wed, 7 Oct 1998, Anand Surelia wrote:

Show quoted text

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.

#3José Soares
jose@sferacarta.com
In reply to: Anand Surelia (#1)
Re: [GENERAL] Row Nums

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'

#4Anand Surelia
anand@bytekinc.com
In reply to: Anand Surelia (#1)
Re: [GENERAL] Row Nums

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.

#5Jackson, DeJuan
djackson@cpsgroup.com
In reply to: Anand Surelia (#4)
RE: [GENERAL] Row Nums

-----Original Message-----
From: Anand Surelia [SMTP:anand@bytekinc.com]
Sent: Thursday, October 08, 1998 2:08 PM
To: Jose' Soares
Cc: pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Row Nums

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.

Try:
create sequence tmp_count;
select nextval('tmp_count') as rowcount, * from sometable_or_view;
drop sequence tmp_count;
-DEJ