--- Richard Broersma Jr <[EMAIL PROTECTED]> 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.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to