Re: Elegant SQL solution:
| От | Josh Berkus |
|---|---|
| Тема | Re: Elegant SQL solution: |
| Дата | |
| Msg-id | 200306071854.30499.josh@agliodbs.com обсуждение |
| Ответ на | Elegant SQL solution: (Chris Gamache <cgg007@yahoo.com>) |
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: