From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Richard Broersma Jr <rabroersma@yahoo.com>
To: SQL Postgresql List <pgsql-sql@postgresql.org>
Subject: Re: Joe Celko's method to "generate_series" not working?
Date: Wed, 2 May 2007 17:35:02 -0700 (PDT)
Message-ID: <105002.73150.qm@web31808.mail.mud.yahoo.com> (raw)
In-Reply-To: <649296.88043.qm@web31815.mail.mud.yahoo.com>
--- Richard Broersma Jr <rabroersma@yahoo.com> wrote:
> Is Mr. Celko mistaken? Does anyone know if PostgreSQL has any functions that I can turn these
> VALUES rows into columns so that the CROSS JOINS will work?
Having posted, I just realized what the correct syntax is:
SELECT hundred * 100 + ten * 10 + unit + 1
FROM ( VALUES( 0 ), ( 1 ), ( 2 ), ( 3 ),
( 4 ), ( 5 ), ( 6 ), ( 7 ),
( 8 ), ( 9 )
) AS Units( unit )
CROSS JOIN
( VALUES( 0 ), ( 1 ), ( 2 ), ( 3 ),
( 4 ), ( 5 ), ( 6 ), ( 7 ),
( 8 ), ( 9 )
) AS Tens( ten )
CROSS JOIN
( VALUES( 0 ), ( 1 ), ( 2 ), ( 3 ),
( 4 ), ( 5 ), ( 6 ), ( 7 ),
( 8 ), ( 9 )
) AS Hundreds( hundred )
ORDER BY hundred * 100 + ten * 10 + unit + 1 ;
Sorry for the noise. :o(
Regards,
Richard Broersma Jr.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rabroersma@yahoo.com
Subject: Re: Joe Celko's method to "generate_series" not working?
In-Reply-To: <105002.73150.qm@web31808.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox