X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 766DE475CA9 for ; Fri, 21 Feb 2003 13:26:42 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 32269-02 for ; Fri, 21 Feb 2003 13:26:31 -0500 (EST) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by postgresql.org (Postfix) with ESMTP id 83831475BA1 for ; Fri, 21 Feb 2003 13:23:07 -0500 (EST) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 9DA643F4F; Fri, 21 Feb 2003 13:23:33 -0500 (EST) From: "Dan Langille" To: "Gaetano Mendola" Date: Fri, 21 Feb 2003 13:25:56 -0500 MIME-Version: 1.0 Subject: Re: 7.3 "group by" issue Cc: pgsql-sql@postgresql.org Message-ID: <3E5628E4.16251.1E808E0F@localhost> In-reply-to: <008a01c2d9d5$92d59ed0$152aa8c0@GMENDOLA2> X-mailer: Pegasus Mail for Windows (v4.02a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/483 X-Sequence-Number: 11881 On 21 Feb 2003 at 19:18, Gaetano Mendola wrote: > > Hi folks, > > > > This query: > > > > SELECT element_id as wle_element_id, COUNT(watch_list_id) > > FROM watch_list JOIN watch_list_element > > ON watch_list.id = watch_list_element.watch_list_id > > AND watch_list.user_id = 1 > > GROUP BY watch_list_element.element_id > > Try: > > SELECT element_id as wle_element_id, COUNT(watch_list_id) > FROM watch_list JOIN watch_list_element > ON watch_list.id = watch_list_element.watch_list_id > WHERE > watch_list.user_id = 1 > GROUP BY watch_list_element.element_id ERROR: Attribute unnamed_join.element_id must be GROUPed or used in an aggregate function -- Dan Langille : http://www.langille.org/