pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bob Hutzel <tidal7@myrealbox.com>
To: pgsql-sql@postgresql.org
Subject: Cross joining table with itself
Date: Sun, 21 Sep 2003 14:38:23 GMT
Message-ID: <pan.2003.09.21.14.33.57.361582@myrealbox.com> (raw)

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.




view thread (2+ messages)  latest in thread

Message-ID: <pan.2003.09.21.14.33.57.361582@myrealbox.com>
Permalink:  ../pan.2003.09.21.14.33.57.361582@myrealbox.com/
Also on:    postgresql.org/message-id/pan.2003.09.21.14.33.57.361582@myrealbox.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tidal7@myrealbox.com
  Subject: Re: Cross joining table with itself
  In-Reply-To: <pan.2003.09.21.14.33.57.361582@myrealbox.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox