Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> SQL query peeps help me!!!!
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:34:57 CDT