From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Robert M(dot) Craver II" <rob(dot)craver(at)home(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Multiple columns w/single aggregate |
Date: | 2001-01-24 14:27:12 |
Message-ID: | 200101241427.JAA15733@candle.pha.pa.us |
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
Sure, you need GROUP BY. How does it know which columns to use for the
MAX.
>
> 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.
>
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Zak McGregor | 2001-01-24 14:34:36 | Re: MySQL has transactions |
Previous Message | Alexander Jerusalem | 2001-01-24 14:25:12 | Sorry for the duplicate postings |