Re: Probably simple answer
От | Command Prompt, Inc. |
---|---|
Тема | Re: Probably simple answer |
Дата | |
Msg-id | Pine.LNX.4.30.0111051625540.9889-100000@commandprompt.com обсуждение исходный текст |
Ответ на | Probably simple answer ("Al Kirkus" <Al@dist102.k12.il.us>) |
Список | pgsql-general |
Hello, You could either select the oid along with your query, or alternatively set up a sequence: http://www.postgresql.info/r23450.htm Sincerely, Joshua Drake Co-Author: Practical PostgreSQL On Thu, 1 Nov 2001, Al Kirkus wrote: > 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 thequery 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. > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- -- by way of pgsql-general@commandprompt.com http://www.postgresql.info/ http://www.commandprompt.com/
В списке pgsql-general по дате отправления: