Re: Grouping by date range

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Grouping by date range
Date: 2003-08-20 17:47:48
Message-ID: 11099.1061401668@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> writes:
> On Tue, 2003-08-19 at 02:56, Alexander Litvinov wrote:
>> select date_part('year', date), count(*) from your_table group by
>> date_part('year', date) order by date_part('year', date);

> Is the ORDER BY really needed here?

If you want the results ordered that way, yes.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2003-08-20 17:53:23 Re: Buglist
Previous Message Ian Harding 2003-08-20 17:23:41 Re: Mailing list in French