Re: How to get list of days between two dates?

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: "Aaron Bono"
Дата:
Сообщение: Re: How to get list of days between two dates?
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: How To Exclude True Values