From: | "Al Kirkus" <Al(at)dist102(dot)k12(dot)il(dot)us> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Probably simple answer |
Date: | 2001-11-01 21:56:17 |
Message-ID: | sbe170b3.013@dist102.k12.il.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Eckermann | 2001-11-01 23:43:24 | Re: Best way to store/search phone numbers? |
Previous Message | Thomas Yackel | 2001-11-01 21:02:06 | Database security in a multi-user environment |