Path: news.easynews.com!easynews!crtntx1-snh1.gtei.net!paloalto-snf1.gtei.net!news.gtei.net!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
From: neil@sw4it.com (mayhem)
Newsgroups: comp.databases.oracle.server,microsoft.public.sqlserver.server,comp.databases.ms-sqlserver
Subject: SQL query peeps help me!!!!
Date: 8 Aug 2002 04:34:57 -0700
Organization: http://groups.google.com/
Lines: 24
Message-ID: <8e8664e8.0208080334.1851bae1@posting.google.com>
NNTP-Posting-Host: 212.158.108.66
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1028806497 17568 127.0.0.1 (8 Aug 2002 11:34:57 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 8 Aug 2002 11:34:57 GMT
Xref: easynews comp.databases.oracle.server:157253 microsoft.public.sqlserver.server:192677 comp.databases.ms-sqlserver:76352
X-Received-Date: Thu, 08 Aug 2002 04:32:01 MST (news.easynews.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,
