Results 1 to 2 of 2
  1. #1
    sab is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Dec 2011
    Posts
    1

    Nested Join Help?

    Hello, I am having difficulties adding on a second INNER JOIN to an existing query I have.



    The following query returns about 10,400 records with a Candidate's ID, the date at which they were most recently contacted, and who contacted them.

    Code:
     
    SELECT e.Candidate_Id, [By whom], [Date], e.Comments
    FROM [Candidates: Contact Summaries] AS e INNER JOIN [SELECT Candidate_Id,
            MAX([Date]) AS LastContact
        FROM [Candidates: Contact Summaries]
        GROUP BY
            Candidate_Id]. AS lu ON e.Candidate_Id = lu.Candidate_Id AND e.Date = lu.LastContact;
    I have another table (Candidates) and I need this query to pull the FirstName and LastName from the Candidates table, but I can't seem to figure out how to properly add on another JOIN. I tried this but it doesn't like it:
    Code:
     SELECT e.Candidate_Id, [By whom], [Date], e.Comments
    FROM [Candidates: Contact Summaries] AS e INNER JOIN [SELECT Candidate_Id,
            MAX([Date]) AS LastContact
        FROM [Candidates: Contact Summaries]
        GROUP BY
            Candidate_Id]. AS lu ON e.Candidate_Id = lu.Candidate_Id AND e.Date = lu.LastContact
        INNER JOIN Candidates ON e.Candidate_Id = Candidates.Candidate_Id
    Access just tells me there's a "Syntax on FROM Clause".

    Thanks for any help!

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The inner select should be surrounded by round brackets : FROM ..., (SELECT....)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  2. Nested If statement
    By Bellablue in forum Access
    Replies: 7
    Last Post: 10-09-2011, 12:00 PM
  3. Nested join problem
    By kman42 in forum Queries
    Replies: 2
    Last Post: 03-25-2011, 02:05 PM
  4. Nested IIF problems
    By Brian Collins in forum Access
    Replies: 2
    Last Post: 10-12-2010, 01:37 PM
  5. Returning correct rows in a join/nested query
    By goneaccessing in forum Queries
    Replies: 5
    Last Post: 03-03-2010, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums