Skip site navigation (1) Skip section navigation (2)

problem with group-by clause/aggreate functions

From: "Shabala Deshpande" <de(dot)shabala(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: problem with group-by clause/aggreate functions
Date: 2008-09-09 09:44:53
Message-ID: (view raw or whole thread)
Lists: pgsql-novice

I am having a problem with group-by clause/aggreate functions... Following
is the query which runs well in mysql....

query :

select min(rt), cnt, link_name, dir, t_rate, rate from fg_table where
obj_type = ? and obj_id = ? and rt > ? and rt_type = 'u' group by link_name,
but when i run it in postgres i get follwing errors:

DBD::Pg::st execute failed: ERROR:  column "fg_table.cnt" must appear in the
GROUP BY clause or be used in an aggregate function

same for the t_rate,rate  fields in SELECT clause which are not included in
the GROUP BY clause.

can anyone please guide me?

thanks n regards,


pgsql-novice by date

Next:From: Bastiaan OlijDate: 2008-09-09 22:54:55
Subject: Re: problem with group-by clause/aggreate functions
Previous:From: Григорий НиконоровDate: 2008-09-09 08:15:06
Subject: Re: Problem wth postgresql.conf

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group