CGG:

> I could create a one-column table with values 1 - 12 in it, and select from
> that table with a where clause matching "month". 

This is probably the simplest, most elegant solution.  It is also the "most 
relational".

> I could also create a view
> "SELECT 1 UNION SELECT 2 UNION ..." and select against the view.

This would be both awkward and have appaling performance.

> There MUST
> be a more elegant way to do this.

Another method would be to write a set returning function that generates the 
months and corresponds them to a cursor of the totals and outputs that.

However, I think your first method is likely to be the fastest and easiest to 
maintain.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to