Postgres - how to return rows with 0 count for missing data?
问题 I have unevenly distributed data(wrt date) for a few years (2003-2008). I want to query data for a given set of start and end date, grouping the data by any of the supported intervals (day, week, month, quarter, year) in PostgreSQL 8.3 (http://www.postgresql.org/docs/8.3/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC). The problem is that some of the queries give results continuous over the required period, as this one: select to_char(date_trunc('month',date), 'YYYY-MM-DD'),count