X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3B01211F6225 for ; Wed, 5 Apr 2006 08:23:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23309-07 for ; Wed, 5 Apr 2006 08:23:58 -0300 (ADT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 1F9A111F623C for ; Wed, 5 Apr 2006 08:23:57 -0300 (ADT) Received: from phobos.webteh.com (phobos.webteh.com [212.18.63.12]) by svr4.postgresql.org (Postfix) with ESMTP id A4DFE5AF868 for ; Wed, 5 Apr 2006 11:23:57 +0000 (GMT) Received: from [190.190.1.108] (BSN-77-157-214.dsl.siol.net [193.77.157.214]) (authenticated bits=0) by phobos.webteh.com (8.13.6/8.13.6) with ESMTP id k35BKqkM003277 for ; Wed, 5 Apr 2006 13:20:53 +0200 Subject: GROUP BY issue From: "Jure Kodzoman (Dhimahi)" To: pgsql-sql@postgresql.org Content-Type: text/plain Date: Wed, 05 Apr 2006 13:23:38 +0200 Message-Id: <1144236218.5303.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200604/73 X-Sequence-Number: 24882 Hy list. I have 3 tables: performance event pool_performance each event has it's performances, and can be assigned to one or more pools. pool_performance holds performance_id, pool_id and from_date performance has event_id and performance_id as primary key what I want to do is select min(pool_performance.from_date), pool_id, event_id group by performance_id but done in a way that I group only performances belonging to the same event but for the same pool, and not all performances. Thanks in advance, Jure