Re: Numbering rows

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Numbering rows
Date: 2008-10-16 05:21:20
Message-ID: 20081016052120.GA25000@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Wed, dem 15.10.2008, um 12:23:42 -0700 mailte Richard Broersma folgendes:
> On Wed, Oct 15, 2008 at 12:08 PM, ries van Twisk <pg(at)rvt(dot)dds(dot)nl> wrote:
> > May be this function can help :
> >
> > http://www.postgresql.org/docs/8.3/static/functions-srf.html
>
> Using generate series won't number the rows that way that you would
> want. You basically will end up with a cross join between the
> generated series and the requested set. There are three ways that I
> know of to get a row number:
>
> 1) IIRC use a pl-pgsql function that returns an incremented number
> 2) use SQL by joining using the operator ">=" and Group by aggregate count(*)
> 3) 8.4 has sum new analytic functions that will do this nicely.

Can you show an example for 8.4?

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ayliffe 2008-10-16 06:23:08 Problems with Timezones in Australia
Previous Message Craig Ringer 2008-10-16 03:56:29 Re: UPDATE and Indexes and Performance