From: Craig May <craig.may@s2.enthdimension.com.au>
To: pgsql-sql@postgresql.org
Subject: Help on Union Query
Date: Wed, 25 Oct 2000 04:44:50 +0000
Message-ID: <20001025044450.A6123@s2.enthdimension.com.au> (raw)
Hi,
I have an Index table with the following structure:
| Node_ID (int) | Word (varchar)|
and attempting to perform a query that returns the distinct Node_ID for
an occurence of [word] in addition to a count of that [word] within the
Node_ID.
Here is the query I have atm:
select distinct on (Node_ID) Node_ID from NodeIndex where word='[a word]' union
select count(*) from NodeIndex where Node_ID in (select distinct on (Node_ID)
Node_ID from NodeIndex where word='[a word]') order by count;
Any assistance would be appreciated.
Craig May
Enth Dimension
http://www.enthdimension.com.au
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: craig.may@s2.enthdimension.com.au
Subject: Re: Help on Union Query
In-Reply-To: <20001025044450.A6123@s2.enthdimension.com.au>
References: <20001025044450.A6123@s2.enthdimension.com.au>
* 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