Grouping by date range

From: Mat <psql-mail(at)freeuk(dot)com>
To: pgsql general list <pgsql-general(at)postgresql(dot)org>
Subject: Grouping by date range
Date: 2003-08-19 07:34:10
Message-ID: 1061278450.3970.10.camel@Arakis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a table with two column, date and data
I would like to do a set of queries to generate statistics on the data,
such as count(data) for month blocks and year blocks. What is the best
way to accomplish this?

dd/mm/yy
date | data
---------------
01/01/01| 123
01/01/01| abc
02/01/01| def
03/03/01| hij

SOME QUERY ....

Year | Count
-------------
01 | 3

I can see how to group by day - but how do i go about decreasing the
precision down to months/years.

Thanks...

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-08-19 07:47:07 Re: Example Database
Previous Message Juris Krumins 2003-08-19 07:26:14 Temporary tables