Row Nums
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.
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.
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'
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.
-----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 NumsJose' Soares wrote:
Anand Surelia wrote:
Hi,
I want to display serial numbers of rows selected by a query. Ican 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 | SomeoneThanks,
Anand.
Try:
create sequence tmp_count;
select nextval('tmp_count') as rowcount, * from sometable_or_view;
drop sequence tmp_count;
-DEJ
Import Notes
Resolved by subject fallback