X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B0EEED1CCB7 for ; Tue, 13 Apr 2004 13:13:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71385-09 for ; Tue, 13 Apr 2004 13:13:08 -0300 (ADT) Received: from web11502.mail.yahoo.com (web11502.mail.yahoo.com [216.136.172.47]) by svr1.postgresql.org (Postfix) with SMTP id B0AC6D1BAFC for ; Tue, 13 Apr 2004 13:13:06 -0300 (ADT) Message-ID: <20040413161305.22857.qmail@web11502.mail.yahoo.com> Received: from [65.207.234.18] by web11502.mail.yahoo.com via HTTP; Tue, 13 Apr 2004 09:13:05 PDT Date: Tue, 13 Apr 2004 09:13:05 -0700 (PDT) From: Terry Brick Subject: Formatting Functions and Group By To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/117 X-Sequence-Number: 17492 Hi, I'm porting a bunch of queries from MySQL to Postgres 7.4 and am having a problem with one particular area. For example, a query like this works in MySQL: select to_char(myCol,'Mon YY') from myTable group by to_char(myCol,'MM YYYY') order by to_char(myCol,'MM YYYY') Postgres will give me an error saying that "to_char(myCol,'Mon YY')" must be in the 'group by'. I understand why that normally needs to be the case, but in theory, it would be ok here because they are actually the same values (in the select and group by) but just formatted differently. I just want the query to be grouped and ordered by month and year, but to be formatted differently in the output. Any ideas? Thanks!! __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/