Path: news.easynews.com!easynews!newshosting.com!news-xfer2.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail
From: "Jim Kennedy" <kennedy-family@attbi.com>
Newsgroups: comp.databases.oracle.server,microsoft.public.sqlserver.server,comp.databases.ms-sqlserver
References: <8e8664e8.0208080334.1851bae1@posting.google.com>
Subject: Re: SQL query peeps help me!!!!
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <KWu49.33667$7n5.6853@sccrnsc01>
NNTP-Posting-Host: 12.241.212.232
X-Complaints-To: abuse@attbi.com
X-Trace: sccrnsc01 1028815658 12.241.212.232 (Thu, 08 Aug 2002 14:07:38 GMT)
NNTP-Posting-Date: Thu, 08 Aug 2002 14:07:38 GMT
Organization: AT&T Broadband
Date: Thu, 08 Aug 2002 14:07:38 GMT
Xref: easynews comp.databases.oracle.server:157271 microsoft.public.sqlserver.server:192688 comp.databases.ms-sqlserver:76360
X-Received-Date: Thu, 08 Aug 2002 07:04:43 MST (news.easynews.com)

Ugly.
1. What is the first address?  Do you mean any of the many addresses that a
contact has?  Since there is no first address in an unordered set.
2. I would, in the future, lose the tbl naming convention, you know its a
table.
Jim
"mayhem" <neil@sw4it.com> wrote in message
news:8e8664e8.0208080334.1851bae1@posting.google.com...
> I've got this query
>
> SELECT  tblContacts.ContactID, tblContacts.FileAs, tblContacts.Title,
> tblContacts.FirstName, tblContacts.LastName, tblContacts.MainContact,
> tblContAddress.Address1, tblContAddress.Address2,
> tblContAddress.Address3, tblContAddress.Address4,
> tblContAddress.Address5, tblContAddress.Town, tblContAddress.County,
> tblContAddress.Postcode, tblContAddress.Country,
> tblInstitutes.InstituteName, tblContLinkAddress.MainAddress
>
> FROM (((( tblContacts INNER JOIN  tblContLinkAddress ON
> tblContacts.ContactID = tblContLinkAddress.ContactID)  INNER JOIN
> tblContAddress ON tblContLinkAddress.AddressID =
> tblContAddress.AddressID)  LEFT JOIN  tblInstitutes ON
> tblContacts.InstituteID = tblInstitutes.InstituteID)  LEFT JOIN
> tblInstituteTypes ON tblInstitutes.InstituteTypeID =
> tblInstituteTypes.InstituteTypeID)
>
> I want the contact info returned but only the first address found for
> each contact, obviously distinct won't work as all rows returned will
> be unique anyway. I assume I have to use GROUP BY in some way. Any
> ideas????
>
> Thanks,


