X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9B9C329C6B for ; Mon, 20 Sep 2004 16:47:52 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06060-01 for ; Mon, 20 Sep 2004 15:47:49 +0000 (GMT) Received: from msgdirector3.onetel.net.uk (msgdirector3.onetel.net.uk [212.67.96.159]) by svr1.postgresql.org (Postfix) with ESMTP id 30C09329C65 for ; Mon, 20 Sep 2004 16:47:45 +0100 (BST) Received: from bolek.coachhouse ([213.78.163.207]) by msgdirector3.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id CSM95419; Mon, 20 Sep 2004 16:47:40 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1C9PsM-0005ZG-00 ; Mon, 20 Sep 2004 16:14:46 +0100 Message-ID: <414EF3E6.9040202@numerixtechnology.de> Date: Mon, 20 Sep 2004 16:14:46 +0100 From: T E Schmitz Reply-To: mailreg@numerixtechnology.de User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql Subject: COUNT(*) to find records which have a certain number of dependencies ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=LINES_OF_YELLING, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200409/159 X-Sequence-Number: 19005 Hello, I apologize in advance for this garbled message but I've been banging my head against a brick-wall for a while and I just can't figure how to do the following: I have 3 tables BRAND,MODEL,TYPE which are related to each other: BRAND ===== BRAND_PK BRAND_NAME MODEL ===== MODEL_PK MODEL_NAME BRAND_FK (NOT NULL, references BRAND_PK) TYPE ==== TYPE_PK TYPE_NAME MODEL_FK (NOT NULL, references MODEL_PK) ------------------------------------ I want to select only those BRAND/MODEL combinations, where the MODEL has more than one TYPE, but only where one of those has TYPE_NAME='xyz'. I am not interested in MODELs with multiple TYPEs where none of them are called 'xyz'. -- Regards/Gruß, Tarlika Elisabeth Schmitz