Probably simple answer

Поиск
Список
Период
Сортировка
От Al Kirkus
Тема Probably simple answer
Дата
Msg-id sbe15b53.085@dist102.k12.il.us
обсуждение исходный текст
Ответы Re: Probably simple answer  ("Command Prompt, Inc." <pgsql-general@commandprompt.com>)
Re: Probably simple answer  ("postgresql" <pgsql@symcom.com>)
Re: Probably simple answer  (Masaru Sugawara <rk73@echna.ne.jp>)
Re: Probably simple answer  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
Hi all.

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

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.

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

Предыдущее
От: cbbrowne@acm.org
Дата:
Сообщение: Re: Sum(time) possible?
Следующее
От: ananthreddy@yahoo.com (ananth)
Дата:
Сообщение: how to return more than one item from function?