Re: Numbering rows

From: ries van Twisk <pg(at)rvt(dot)dds(dot)nl>
To: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
Cc: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Numbering rows
Date: 2008-10-15 19:08:26
Message-ID: 16170243-B840-4478-BA05-99221EA67915@rvt.dds.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

May be this function can help :

http://www.postgresql.org/docs/8.3/static/functions-srf.html

Ries
On Oct 15, 2008, at 1:44 PM, Mark Morgan Lloyd wrote:

> Is there an easy way to assign a sequential number, possibly based
> on an arbitrary minimum (typically 0 or 1) to each row of an ordered
> result set, or do I have to work with explicit sequences?
>
> I need to do quite a lot of maths on successive rows, extracting
> numeric and timestamp differences hence rates of change. I've
> typically been doing it manually or in a spreadsheet but there has
> to be a better way e.g. by a join on offset row numbers.
>
> --
> Mark Morgan Lloyd
> markMLl .AT. telemetry.co .DOT. uk
>
> [Opinions above are the author's, not those of his employers or
> colleagues]
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma 2008-10-15 19:23:42 Re: Numbering rows
Previous Message Mark Morgan Lloyd 2008-10-15 18:44:06 Numbering rows