Re: Syntax bug? Group by?

From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Mark Woodward <pgsql(at)mohawksoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Syntax bug? Group by?
Date: 2006-10-17 17:53:31
Message-ID: 4535189B.7010705@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Mark,

Mark Woodward wrote:
> Shouldn't this work?
>
> select ycis_id, min(tindex), avg(tindex) from y where ycis_id = 15;
>
> ERROR: column "y.ycis_id" must appear in the GROUP BY clause or be used
> in an aggregate function
>
> If I am asking for a specific column value, should I, technically
> speaking, need to group by that column?

Try:

SELECT 15 as ycis_id, min(tindex), avt(tindex) from y where ycis_id = 15;

HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nolan Cafferky 2006-10-17 17:54:58 Re: Syntax bug? Group by?
Previous Message Florian Weimer 2006-10-17 17:53:00 Re: Asynchronous I/O Support