Probably simple answer - Mailing list pgsql-general

From Al Kirkus
Subject Probably simple answer
Date
Msg-id sbe170b3.013@dist102.k12.il.us
Whole thread Raw
List 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 by date:

Previous
From: Andrew Gould
Date:
Subject: Re: Best way to store/search phone numbers?
Next
From: "Dinesh Parikh"
Date:
Subject: GoTo statement problem