X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2C240D1B561 for ; Wed, 17 Mar 2004 20:22:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58880-06 for ; Wed, 17 Mar 2004 16:22:01 -0400 (AST) Received: from php.gurugeek.org (unknown [213.174.166.198]) by svr1.postgresql.org (Postfix) with ESMTP id 226A7D1E943 for ; Wed, 17 Mar 2004 16:21:59 -0400 (AST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by php.gurugeek.org (Postfix) with ESMTP id 959A124DF00 for ; Wed, 17 Mar 2004 21:21:57 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v612) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-php@postgresql.org From: David Costa Subject: Query Problem Date: Wed, 17 Mar 2004 21:21:56 +0100 X-Mailer: Apple Mail (2.612) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/38 X-Sequence-Number: 2637 Hi There !! My turn to ask for some help ;) a friend of mine has a problem with this query: SELECT zblog_category.catname, zblog_entry.entry_id, zblog_entry.entrytext, zblog_entry.entrytitle, zblog_entry.timestamp_creation, zblog_user.username, COUNT(zblog_comment.comment_id) AS comment_amount FROM zblog_comment RIGHT JOIN (zblog_user INNER JOIN (zblog_entry INNER JOIN zblog_category ON (zblog_category.cat_id = zblog_entry.id_cat)) ON (zblog_entry.id_user = zblog_user.user_id)) ON (zblog_comment.id_entry = zblog_entry.entry_id) WHERE zblog_comment.id_entry = zblog_entry.entry_id AND zblog_category.cat_id = zblog_entry.id_cat AND zblog_user.user_id = zblog_entry.id_user AND zblog_entry.timestamp_creation >= 1 AND zblog_entry.timestamp_creation < 999999999999 GROUP BY zblog_entry.entry_id ORDER BY zblog_entry.timestamp_creation DESC The error we are getting is this ERROR: column "zblog_category.catname" must appear in the GROUP BY clause or be used in an aggregate function any idea? we kept trying for hours to no avail *sigh* :'( thanks in advance for your time and attention! Regards, David Costa, PHP-PostgreSQL Advocacy team http://dotgeek.org david at postgresql ddoot org gurugeek att php dot net $dsn = 'pgsql://world:most_advanced@localhost/open_source_database';