Re: - Mailing list pgsql-sql

From Tomas Berndtsson
Subject Re:
Date
Msg-id 80k8azqzg4.fsf@junk.nocrew.org
Whole thread Raw
In response to  (jan.bajerski@viterra.pl)
List pgsql-sql
jan.bajerski@viterra.pl writes:

> Hello,
>      I have following problem with PostgreSQL 6.5.3, I haven't possiblity
> to check it on 7.0 and I want to know is it possible to run such query:
> 
> SELECT    k.pic, id_g, id_k, count(*)
> FROM kart k, pictues p
> WHERE k.pic = p.pic
> GROUP BY k.pic
> 
> PICTURES(pic,id_g,id_k)
> KART  (pic,email,mess,date)
> 
> I've got answer from Postgres
> "Illegal attributes or non-group column"
> 
> Is it error in query or in parser ?

You need to have all non-aggragated columns in the GROUP BY:

SELECT    k.pic, id_g, id_k, count(*)
FROM kart k, pictues p
WHERE k.pic = p.pic
GROUP BY k.pic, id_g, id_k



Tomas


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re:
Next
From:
Date:
Subject: Re: