I\'d like to get the list of days between the two dates (including them) in a PostgreSQL database. For example, if I had:
select generate_series('2012-06-29', '2012-07-03', '1 day'::interval)::date;
If you already have database that you want to query:
SELECT
TO_CHAR(date_column,'DD Mon YYYY')
FROM
some_table
WHERE
date_column BETWEEN '29 Jun 2012' AND '3 JUL 2012'
GROUP BY date_column
ORDER BY date_column
This will result in:
"29 Jun 2012"
"30 Jun 2012"
"01 Jul 2012"
"02 Jul 2012"
"03 Jul 2012"