Carol Cheung <cacheung@consumercontact.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