| От | Scott Marlowe |
|---|---|
| Тема | Re: How to get list of days between two dates? |
| Дата | |
| Msg-id | 1149628942.25526.232.camel@state.g2switchworks.com обсуждение |
| Ответ на | Re: How to get list of days between two dates? ("Aaron Bono" <postgresql@aranya.com>) |
| Список | pgsql-sql |
On Tue, 2006-06-06 at 16:17, Aaron Bono wrote: > Though there may be a more eligant way to do it, when we did things > like this in the past we created a function (or stored procedure) that > got the min and max dates and then created a result set that iterated > through the dates to create a virtual table of days. Then you can > inner join that list of days with your physical table. If you're on a version of pgsql with generate_series, you can use that to easily create a pivoting data set on the fly to do this. If you're on an older version, it's easy enough to make a generic pivot table and keep it around to do these things. Since we're still on 7.4 where I work, we use the pre-populated pivot table. It's primitive, but it works.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера