Re: Probably simple answer

Поиск
Список
Период
Сортировка
От Masaru Sugawara
Тема Re: Probably simple answer
Дата
Msg-id 20011107072048.D1A3.RK73@echna.ne.jp
обсуждение исходный текст
Ответ на Re: Probably simple answer  (Masaru Sugawara <rk73@echna.ne.jp>)
Список pgsql-general
On Wed, 07 Nov 2001 00:40:50 +0900
I wrote:


> On Thu, 01 Nov 2001 14:24:29 -0600
> "Al Kirkus" wrote:
>
>
> > Can anyone tell me how to get a sequential row count field in the output of a query?
> >
> > Say I want to query for all users in a table sorted by lastname and firstname.
> > I would like to include a column in my query called "rownum" which would uniquely
> > identify the row in the order of the query results.
> >
> > Like this:
> >
> > rownum =1   lastname=jones, firstname=john
> > rownum=2 lastname=smith, firstname=john
> >
> > etc.
> > I assume rownum should be some kind of function of expresion but I don't know what.
> >
> > Something like:
> >
> > Select ???? as rownum, lastname,firstname from users
> >          where xxx =xxx order by lastname, firsname.
> >
>
>
> Ugh, that sounds like an oracle command. Instead of a rownum,
> as I understand it, you need to use a sequence which has already
> mentioned by Joshua. A following query A or B is what you want
> to select, isn't it?
>
>


Note !
In case of multi access, you must create sequences with unique name
per user or client PC, and must make each user or each PC use an
allocated sequence, respectively. In addition, each user or each PC
mustn't execute more than two queries at one time.


Probably, It doesn't increase evenly if there happen to be multi access
to a sequence.




Masaru Sugawara


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

Предыдущее
От: "Eric Ridge"
Дата:
Сообщение: Re: pg_dump and DEFAULT column values
Следующее
От: Martín Marqués
Дата:
Сообщение: Re: Sourceforge moving from PostgreSQL to Oracle