1 Jun
2011
1 Jun
'11
7:39 p.m.
On Wed, Jun 1, 2011 at 12:31 PM, Niels Nes
Indeed we don't allow functions within the group by list (only column or alias references). Shouldn't be a big problem. In this case it goes wrong because 'year' is a keyword which needs double quotes if you want to use it as alias/ident.
Ah, I didn't recognize that 'year' was a keyword. Thanks! Seems to work fine now. sql>select extract( year from ts ) as myyear, category, count(category) from foo group by myyear, category order by 3 desc; +--------+----------+------+ | myyear | category | L7 | +========+==========+======+ | 2010 | bar | 1 | | 2011 | baz | 1 | +--------+----------+------+ 2 tuples (2.614ms)