Path: news.easynews.com!easynews!crtntx1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.algonet.se!algonet!news2.tninet.se!not-for-mail
From: "Lasse Edsvik" <lasse@nospam.com>
Newsgroups: comp.databases.oracle.server,microsoft.public.sqlserver.server,comp.databases.ms-sqlserver
Subject: Re: SQL query peeps help me!!!!
Date: Thu, 8 Aug 2002 13:44:42 +0200
Organization: Telenordia/Algonet
Lines: 36
Message-ID: <aitllp$bb3$1@green.tninet.se>
References: <8e8664e8.0208080334.1851bae1@posting.google.com>
NNTP-Posting-Host: 62.168.149.29
X-Trace: green.tninet.se 1028807161 11619 62.168.149.29 (8 Aug 2002 11:46:01 GMT)
X-Complaints-To: postmaster@telenordia.se
NNTP-Posting-Date: Thu, 8 Aug 2002 11:46:01 +0000 (UTC)
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
Xref: easynews comp.databases.oracle.server:157254 microsoft.public.sqlserver.server:192678 comp.databases.ms-sqlserver:76353
X-Received-Date: Thu, 08 Aug 2002 04:42:20 MST (news.easynews.com)

mayhem,

how could anyone understand this spaghetti-code without having DDL, sample
data and an explination of what you are trying to accomplish, desired
results and so on?

/Lasse

"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,


