#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    uk
    Posts
    91
    Rep Power
    11

    Help with complex query please


    Hi All,

    Here is my current statement:

    SELECT au.AgencyID, au.UserID, au.StartDate, au.EndDate, f.IACS, f.VendorNo, f.CPH, ad.BusinessName, cn.Name
    FROM dbo.Authority au INNER JOIN
    dbo.User f ON au.UserID = f.ID INNER JOIN
    dbo.Address ad ON f.AddrID = ad.ID INNER JOIN
    dbo.ContactNames cn ON cn.AgencyID = au.AgencyID
    WHERE (au.AgencyID = '201')

    The above statement returns all Rows. The Authority table has Multiple records for an AgencyID/UserID combination However I want to reduce the total amount of records returned by only returning the 1st unique AgencyID/UserID combination. I'm having trouble making this complex query

    Thanks
  2. #2
  3. Digitally Challenged
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    280
    Rep Power
    11
    could you show the table structure?
    My brain cells are like a storm trooper's armor: useless

IMN logo majestic logo threadwatch logo seochat tools logo