Re: Probably simple answer - Mailing list pgsql-general

From Command Prompt, Inc.
Subject Re: Probably simple answer
Date
Msg-id Pine.LNX.4.30.0111051625540.9889-100000@commandprompt.com
Whole thread Raw
In response to Probably simple answer  ("Al Kirkus" <Al@dist102.k12.il.us>)
List 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 by date:

Previous
From: Martín Marqués
Date:
Subject: Re: data integrity
Next
From: "Command Prompt, Inc."
Date:
Subject: Re: functions, shell script