Multiple columns w/single aggregate

From: "Robert M(dot) Craver II" <rob(dot)craver(at)home(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Multiple columns w/single aggregate
Date: 2001-01-21 21:12:24
Message-ID: 3A6B502B.8762960E@home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I cannot successfully execute the sql statement:

SELECT percentage, MAX(start_date) FROM sometable
WHERE id = 1

I get the error message:

ERROR: Attribute sometable.percentage must be GROUPed
or used in an aggregate function

I know that I have seen examples of selecting multiple columns with a
single colunn aggregate function. In fact, the new 'PostgreSQL:
Introductions and Concepts' book by Bruce Momjian has two on page 53.
Does anyone know why this doesn't work?

Thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nic Ferrier 2001-01-21 21:20:36 creating groups (and list archives broken?)
Previous Message Tom Lane 2001-01-21 18:59:14 Re: ACS Web Server & PostgreSQL