Re: [SQL] Elegant SQL solution:

2003-06-08 Thread Ian Barwick
On Friday 06 June 2003 18:26, Chris Gamache wrote: > I could create a one-column table with values 1 - 12 in it, and select from > that table with a where clause matching "month". I could also create a view > "SELECT 1 UNION SELECT 2 UNION ..." and select against the view. There MUST > be a more e

Re: [SQL] Elegant SQL solution:

2003-06-08 Thread Josh Berkus
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

Re: [SQL] Elegant SQL solution:

2003-06-08 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > SELECT date_part('month',rowdate) as month, count(*) as rows FROM mytable GROUP > BY month; >... > I could create a one-column table with values 1 - 12 in it, and select from > that table with a where clause matching "month". I could also create a