pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Costa <geeks@dotgeek.org>
To: pgsql-php@postgresql.org
Subject: Query Problem
Date: Wed, 17 Mar 2004 21:21:56 +0100
Message-ID: <BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org> (raw)

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';





view thread (2+ messages)  latest in thread

Message-ID: <BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org>
Permalink:  ../BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org/
Also on:    postgresql.org/message-id/BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: geeks@dotgeek.org
  Subject: Re: Query Problem
  In-Reply-To: <BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org>
  References: <BC824720-7850-11D8-8ABC-000A95EB456A@dotgeek.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox