Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query peeps help me!!!!

Re: SQL query peeps help me!!!!

From: Roy Harvey <RoyHarv_at_compuserve.com>
Date: Thu, 08 Aug 2002 08:44:41 -0400
Message-ID: <4rp4lucfsqdhogdcmf2v8q7t2m21aq4qgi@4ax.com>


Neil,

>I want the contact info returned but only the first address found for
>each contact.....

This will look best if viewed with a fixed pitch font.

SELECT C.ContactID, C.FileAs, C.Title,
       C.FirstName, C.LastName, C.MainContact,
       A.Address1, A.Address2,
       A.Address3, A.Address4,
       A.Address5, A.Town, A.County,
       A.Postcode, A.Country,
       I.InstituteName, L.MainAddress

  FROM tblContacts as C
  JOIN tblContLinkAddress as L
    ON C.ContactID = L.ContactID
  JOIN tblContAddress as A
    ON L.AddressID = A.AddressID
  LEFT JOIN tblInstitutes as I
    ON C.InstituteID = I.InstituteID)
  LEFT JOIN tblInstituteTypes as T
    ON I.InstituteTypeID = T.InstituteTypeID)  WHERE A.AddressID = (select min(AddressID)
                        from tblContLinkAddress as L2
                       where C.ContactID = L2.ContactID)

Roy Received on Thu Aug 08 2002 - 07:44:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US