Cross joining table with itself

From: Bob Hutzel <tidal7(at)myrealbox(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Cross joining table with itself
Date: 2003-09-21 14:38:23
Message-ID: pan.2003.09.21.14.33.57.361582@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I've been stumped trying to solve this problem via SQL. I have a table ID,
member1, member2, member3. In any row, any member field may have a value
or be null. I want to tally up how many times each member appears in the
table as a whole. For example, if two entries were ('a', '', 'c') and
('b', 'c', ''), I'd like my final result to be:

a, 1
b, 1
c, 2

Is this feasible? Thank you for any help.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-09-22 01:12:30 Re: Cross joining table with itself
Previous Message Kevin Houle 2003-09-20 22:55:34 Re: Unique Constraint Based on Date Range