Re: counts of groupings by date year-month

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Carol Cheung <cacheung(at)consumercontact(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: counts of groupings by date year-month
Date: 2009-02-27 21:50:09
Message-ID: 24305.1235771409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Carol Cheung <cacheung(at)consumercontact(dot)com> writes:
> I tried something like
> SELECT to_char(access_date, 'YYYYMM') as year_month, count(year_month)
> FROM temp GROUP BY year_month ORDER BY year_month;

The only problem in what you wrote was the illegal cross-reference
from one output column to another. Just use count(*) instead.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2009-02-27 21:52:16 Re: counts of groupings by date year-month
Previous Message Scott Marlowe 2009-02-27 21:47:17 Re: counts of groupings by date year-month