X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1F9089FA3D7 for ; Sun, 11 Jun 2006 15:36:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 35838-07 for ; Sun, 11 Jun 2006 15:36:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31810.mail.mud.yahoo.com (web31810.mail.mud.yahoo.com [68.142.207.73]) by postgresql.org (Postfix) with SMTP id 024DA9FA5DD for ; Sun, 11 Jun 2006 15:36:44 -0300 (ADT) Received: (qmail 19895 invoked by uid 60001); 11 Jun 2006 18:36:39 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=RdsT9YEMSpzzZmhEJqjJAbwBVOKCeRv0+ReYOzXi9HpmRK6hIq4m13Tvep92SJTJiOAj+12s0K9k1Of7zLbNxra945CeTmqacu8OT+N7z19RXur4ojMIhtV1CcVddLKieuYUZEhx35Z5Geg9QuQFFrPhuxiTHUkv/mivO7UnfK4= ; Message-ID: <20060611183639.19893.qmail@web31810.mail.mud.yahoo.com> Received: from [68.235.218.116] by web31810.mail.mud.yahoo.com via HTTP; Sun, 11 Jun 2006 11:36:39 PDT Date: Sun, 11 Jun 2006 11:36:39 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Finding multiple events of the same kind To: "Leif B. Kristensen" , pgsql-sql@postgresql.org In-Reply-To: <200606111534.17393.leif@solumslekt.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/117 X-Sequence-Number: 25353 > On Sunday 11. June 2006 15:27, Frank Bax wrote: > >SELECT participants.person_fk, count(participants.person_fk) FROM > > events, participants > >    WHERE events.event_id = participants.event_fk > >         AND events.tag_fk in (2,62,1035) > >    GROUP BY participants.person_fk HAVING > > count(participants.person_fk) > 1 > > That worked like a charm! Thank you very much! > -- Also, you could create a unique column constraint that would prevent multiply instances of the same person in the participants table. Regards, Richard Broersma Jr.