Re: Probably simple answer

From: "postgresql" <pgsql(at)symcom(dot)com>
To: "Al Kirkus" <Al(at)dist102(dot)k12(dot)il(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Probably simple answer
Date: 2001-11-06 13:19:19
Message-ID: 200111061309.fA6D97q45188@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think you need to define more clearly what you want as an end
product. You could create a serial column however there are
possibilities of skipped numbers. Next, how do these 'row number'
relate to your data when you delete a row? Do you expect that the
remaining rows will re-number themselves? Is this 'number' a client
id number?

This sounds like you need to better define your data needs.
Before anyone can help, you need to be clearer.

Ted

-----Original Message-----
From: "Al Kirkus" <Al(at)dist102(dot)k12(dot)il(dot)us>
To: pgsql-general(at)postgresql(dot)org
Date: Thu, 01 Nov 2001 14:24:29 -0600
Subject: [GENERAL] Probably simple answer

> 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.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an
appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so
that your
> message can get through to the mailing list cleanly
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Michel POURE 2001-11-06 13:34:35 Re: Optimization (Was: [HACKERS] Serious performance problem)
Previous Message Justin Clift 2001-11-06 12:14:05 Re: postgres copy command