Re: SQL error - please help.

From: "A(dot) Kretschmer" <akretschmer(at)despammed(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL error - please help.
Date: 2005-08-22 12:52:24
Message-ID: 20050822125224.GF19186@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am 23.08.2005, um 0:24:53 +1200 mailte Bernard folgendes:
> SELECT
> DEPARTMENT.PK,
> DEPARTMENT.NAME,
> MIN(PROJECT.VALUE)AS RATING
> FROM DEPARTMENT,
> PROJECT
> WHERE DEPARTMENT.PK=PROJECT.DEPARTMENT_FK
> GROUP BY DEPARTMENT.PK
> ORDER BY DEPARTMENT.PK;
>
> ERROR: column "department.name" must appear in the GROUP BY clause or
> be used in an aggregate function

Add a ',department.name' to the 'GROUP BY' ->

...
PROJECT
WHERE DEPARTMENT.PK=PROJECT.DEPARTMENT_FK
GROUP BY DEPARTMENT.PK, department.name
ORDER BY DEPARTMENT.PK;
...

Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel Horne 2005-08-22 12:54:41 Re:
Previous Message Sean Davis 2005-08-22 12:36:41 Re: SQL error - please help.