Re: Numbering rows

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "ries van Twisk" <pg(at)rvt(dot)dds(dot)nl>, "Mark Morgan Lloyd" <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: Numbering rows
Date: 2008-10-15 19:42:00
Message-ID: 396486430810151242x65da9f1dq1b376b20fdb00d2d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 15, 2008 at 12:32 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:

> Can't you put the query into a subselect with an offset 0 and join to
> that to get the generate_series to work correctly?

I've never heard of doing it that way, but I'm very interestes in
seeing how it is done. This is what i've tried so far, but am still
getting the cross join:

postgres=#
select * from generate_series(1,3)
CROSS JOIN ( values('a'),('b'),('c') ) as myvals( letter )
OFFSET 0;

generate_series | letter
-----------------+--------
1 | a
2 | a
3 | a
1 | b
2 | b
3 | b
1 | c
2 | c
3 | c
(9 rows)

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rodrigo Gonzalez 2008-10-15 20:05:20 Re: Get PG version using JDBC?
Previous Message Michele Petrazzo - Unipex srl 2008-10-15 19:33:26 No select permission on a table but can query it