JOIN and aggregate problem

From: Tarlika Elisabeth Schmitz <postgresql(at)numerixtechnology(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: JOIN and aggregate problem
Date: 2009-02-20 18:04:42
Message-ID: 20090220180442.45a65170@dick.coachhouse
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have 2 tables T1 and T2

T1 has the columns: D, S, C. The combination of D,S,C is unique.
T2 has the columns: D, S, C, and boolean X. The combination of D,S,C is
not unique.

I need to produce the following result for every occurrence of T1:
D,S,C, COUNT

COUNT is the number of matching D,S,C combinations in T2 where X = true.
There might be no matching pair in T2 or there might be match but X
is false.

How can I express this?

--

Best Regards,

Tarlika Elisabeth Schmitz

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bob Henkel 2009-02-20 19:03:26 Re: JOIN and aggregate problem
Previous Message M.P.Dankoor 2009-02-20 15:41:22 Re: How concat 3 strings if 2 are not empty?