From: "Ian C. Sellers" <"ian"@mystical.net (temporarily out-of-order)>
Subject: Re: Can't get my query right!!
Date: 1997/08/08
Message-ID: <5sfeqq$7vp@news-1.boco.co.gov>#1/1
References: <33E8C278.13703AF7@crim.ca> <33E9EEE3.B096B1A9@columbia.edu>
X-Priority: 3 (Normal)
Organization: Boulder County GIS
Reply-To: icslu@boco.co.gov
Newsgroups: comp.databases.oracle.tools



<HTML>
Chris,

<P>I don't think this meets the intent of the query.&nbsp; David wanted
to match each name with <U>one</U> of its addresses, while this will match
each name with <U>all</U> of its addresses.

<P>chris wrote:
<BLOCKQUOTE TYPE=CITE>&nbsp;&nbsp; Try this:

<P>SELECT&nbsp;&nbsp;&nbsp; NAME.NAME, NAME.KEY, ADDRESS.ADDRESS
<BR>FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NAME, ADDRESS
<BR>WHERE&nbsp;&nbsp;&nbsp;&nbsp; NAME.KEY = ADDRESS.KEY;

<P>good luck.

<P>Christopher Suh</BLOCKQUOTE>
I think this would be the simplist way to write it.&nbsp; MIN could be
replaced by some other group function, built-in or created, depending on
which address you wish to select.

<P>SELECT DISTINCT NAME.NAME, NAME.KEY, MIN(ADDRESS.ADDRESS)
<BR>FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
NAME, ADDRESSWHERE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
NAME.KEY = ADDRESS.KEY;

<P>enjoy.
<BR>-Ian</HTML>



