Re: Can't get my query right!!

From: Ian C. Sellers <"Ian>
Date: 1997/08/08
Message-ID: <5sfeqq$7vp_at_news-1.boco.co.gov>#1/1


<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>
Received on Fri Aug 08 1997 - 00:00:00 CEST

Original text of this message