From: Martin Christensen <factotum@mail1.stofanet.dk>
To: pgsql-sql@postgresql.org
Subject: Many-to-one subquery
Date: 16 Aug 2000 14:47:46 +0200
Message-ID: <87wvhh5q4t.fsf@fangorn.inspocknito> (raw)
I have a problem that I have not been able to solve efficiently, and
I'm confident that it can be done in a single query.
I have a mailing list archive that I want to do some statistics on. It
would tremendously ease my work if I could extract such statistics for
each individual poster in one go. That would, of course, be quite
easy, if I could do a SELECT DISTINCT poster FROM maillist as a
subquery and use that as an argument. For instance, if I have a
function postpct(date, date, varchar(30)) that calculates the
percentage of posts that a certain poster ($3) is responsible in a
certain time interval ($1 to $2), then how do I go about feeding that
function all distinct poster entries? I've tried different things with
joins, but the bit that actually worked was horribly inefficient.
Martin
--
GPG public key: http://home1.stofanet.dk/factotum/gpgkey.txt
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: factotum@mail1.stofanet.dk
Subject: Re: Many-to-one subquery
In-Reply-To: <87wvhh5q4t.fsf@fangorn.inspocknito>
References: <87wvhh5q4t.fsf@fangorn.inspocknito>
* 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