Re: Numbering rows

From: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Numbering rows
Date: 2008-10-15 20:18:08
Message-ID: gd5j62$7cv$1@pye-srv-01.telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks everybody- I'm watching with a lot of interest. I was worried
that I was asking something stupid with an obvious answer...

ries van Twisk wrote:
> May be this function can help :
>
> http://www.postgresql.org/docs/8.3/static/functions-srf.html

Thanks, that's already turning out to be useful for something else I was
working on today:

select percent,
to_char(nedcar_tonnes_001(percent), '99990.99') AS nedcar
from generate_series(0,110,10) as percent;

The one thing I'd say about generate_series() is that the description
suggests that one has to put an explicit count() as the second parameter
if using it to number rows, i.e. it doesn't have an "as many as
necessary" option.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

In response to

Browse pgsql-general by date

  From Date Subject
Next Message D. Dante Lorenso 2008-10-15 20:18:54 Re: Numbering rows
Previous Message Scott Marlowe 2008-10-15 20:05:51 Re: No select permission on a table but can query it