RE: [GENERAL] Row Nums

Поиск
Список
Период
Сортировка
От Jackson, DeJuan
Тема RE: [GENERAL] Row Nums
Дата
Msg-id F10BB1FAF801D111829B0060971D839F461A41@cpsmail
обсуждение исходный текст
Список pgsql-general

> -----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


В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] select * from table where oid = number;
Следующее
От: ArtFile Pte Ltd
Дата:
Сообщение: subscribe