Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6HIb2a06352 for ; Tue, 17 Jul 2001 14:37:02 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 86935 for ; Tue, 17 Jul 2001 11:37:00 -0700 From: "Josh Berkus" Subject: Re: using custom column names in a group by clause To: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Tue, 17 Jul 2001 11:37:00 -0700 Message-ID: In-Reply-To: <3612a608.0107130833.58902406@posting.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200107/228 X-Sequence-Number: 4024 Matt, First of all, this is a PostgreSQL list, so we're not going to be able to give you much help with Oracle. > The following select sets two custom column names using the same > original column name. When I try to include a custom column name in > a > group by clause I get ORA-00904: invalid column name from Oracle. > How > can I access a column name I created in the group by clause? Second, I'd say that your answer is self-evident; use the real column name rather than the custom column name. If the column is just being aliased in order to display it twice, then it doesn't matter which one you group by. Third, Matt, PostgreSQL 7.1.2 DOES support aliasing in GROUP BY clauses. Maybe it's time to switch databases? select client_name as clname1, client_name as clname2, AVG(status) from clients group by clname1, clname2 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco