Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query peeps help me!!!!
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_at_sw4it.com> wrote in message
news:8e8664e8.0208080334.1851bae1_at_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,
Received on Thu Aug 08 2002 - 06:44:42 CDT