COUNT(*) to find records which have a certain number of dependencies ? - Mailing list pgsql-sql

From T E Schmitz
Subject COUNT(*) to find records which have a certain number of dependencies ?
Date
Msg-id 414EF3E6.9040202@numerixtechnology.de
Whole thread Raw
Responses Re: COUNT(*) to find records which have a certain number of dependencies ?  (Greg Stark <gsstark@mit.edu>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Theodore Petrosky
Date:
Subject: Re: How to check postgres running or not ?
Next
From: T E Schmitz
Date:
Subject: Re: COUNT(*) to find records which have a certain number of