COUNT(*) to find records which have a certain number of dependencies ?

From: T E Schmitz <mailreg(at)numerixtechnology(dot)de>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: COUNT(*) to find records which have a certain number of dependencies ?
Date: 2004-09-20 15:14:46
Message-ID: 414EF3E6.9040202@numerixtechnology.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches 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

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Abhijit Menon-Sen 2004-09-20 15:23:37 Re: libpq and prepared statements progress for 8.0
Previous Message Tom Lane 2004-09-20 15:02:50 Re: libpq and prepared statements progress for 8.0

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2004-09-20 16:19:11 Re: COUNT(*) to find records which have a certain number of
Previous Message Theodore Petrosky 2004-09-20 13:46:07 Re: How to check postgres running or not ?