Re: Generating a list of days

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Generating a list of days
Дата
Msg-id 3C98B1C8.3B65AEA6@fourpalms.org
обсуждение исходный текст
Ответ на Generating a list of days  (Fraser Murray <frasernm@yahoo.co.uk>)
Ответы Re: Generating a list of days
Список pgsql-general
> I'm trying to generate a list of days between a start
> date and an end date for use in a query - I would then
> do an outer join with some other data for graphing
> purposes as I need all the days with 0 entries.

istm that you would be able to simply qualify your query with a

WHERE your_date_column BETWEEN 'your_start_date" AND 'your_end_date'

You can use GROUP BY/HAVING to get missing results, or just select on
the NULL columns in the outer join you have already suggested.

If you put the date column in the output also then you would have the
list available at that point.

If you are using perl and actually want a complete list of the *missing*
dates, which is of course what you said you wanted, I would suggest
doing the above query (which can be efficient) and then generate the
list of missing dates using perl (which is also efficient generating a
list).

Folks may have other good suggestions too...

hth

                      - Thomas

В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Eckermann
Дата:
Сообщение: Re: How to create crude report with psql and/or plpgsql
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: Bad timestamp external representation '2001-05-11