Re: SELECT syntax question - combining COUNT and DISTINCT

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Cath Lawrence <Cath(dot)Lawrence(at)anu(dot)edu(dot)au>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: SELECT syntax question - combining COUNT and DISTINCT
Date: 2003-10-01 18:03:23
Message-ID: om5mnvsiddqcimk47du9fqsbl2mr703bpe@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 1 Oct 2003 17:26:55 +1000, Cath Lawrence
<Cath(dot)Lawrence(at)anu(dot)edu(dot)au> wrote:
>"SELECT DISTINCT chain_id FROM chain WHERE pdb_id IN (SELECT pdb_code
>FROM pdb_entry WHERE chain_count=1);"
>This looks OK but takes apparently forever

SELECT DISTINCT c.chain_id
FROM chain AS c, pdb_entry AS p
WHERE c.pdb_id = p.pdb_code
AND p.chain_count = 1;

Servus
Manfred

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tim Wright 2003-10-01 20:43:19 Anything like Oracle's "connect by" SQL?
Previous Message Josh Berkus 2003-10-01 17:38:53 Re: Ideal Hardware?