Is this query optimized?
From: lawpoop <lawpoop_at_gmail.com>
Date: Fri, 12 Jun 2009 12:27:03 -0700 (PDT)
Message-ID: <77203872-9f81-4cfc-ac34-6aaf1c3a9b02_at_d19g2000prh.googlegroups.com>
I want to make an array of RGB colors. For the set ( 0, 64, 128, 192, 255 ), I want to have each combination thereof ( the Cartesian product? ) .
SELECT 192 AS b UNION SELECT 255 AS b ) AS b
Date: Fri, 12 Jun 2009 12:27:03 -0700 (PDT)
Message-ID: <77203872-9f81-4cfc-ac34-6aaf1c3a9b02_at_d19g2000prh.googlegroups.com>
I want to make an array of RGB colors. For the set ( 0, 64, 128, 192, 255 ), I want to have each combination thereof ( the Cartesian product? ) .
This is the query I have to do it:
SELECT r, g, b FROM
( SELECT 0 AS r UNION SELECT 64 AS r UNION SELECT 128 AS r UNION
SELECT 192 AS r UNION SELECT 255 AS r ) AS r
,( SELECT 0 AS g UNION SELECT 64 AS g UNION SELECT 128 AS g UNION
SELECT 192 AS g UNION SELECT 255 AS g ) AS g
SELECT 192 AS b UNION SELECT 255 AS b ) AS b
Is there a simpler way? Received on Fri Jun 12 2009 - 21:27:03 CEST