Results 1 to 5 of 5
  1. #1
    Noob's Avatar
    Noob is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    36

    Help Understanding Nested INNER JOIN

    Hi,

    I am having a hard time wrapping my head around this Query. I need to be able to explain in plain english what it is doing.

    Code:
    UPDATE     [a Cust Data]
    INNER JOIN (G_N_TRANS 
    INNER JOIN [REF Mail NIPPS] 
    ON         G_N_TRANS.N_P_ID = [REF Mail NIPPS].NAB) 
    ON         [a Cust Data].NPI = G_N_TRANS.NPI_ID 
    SET        [a Cust Data].[Mail/Retail] = "Mail" 
    WHERE      ((( 
                                                [a Cust Data].NPI) IS NOT NULL 
                          AND        ( 
                                                [a Cust Data].NPI)<>"")));
    I think that SQL is going to Start by JOINING the 2nd JOIN1st. So if that is TRUE then. The 2nd INNER JOIN is going to use TABLEs"REF Mail NIPPS" & "G_N_TRANS" & what is throwingme is that the FIELD NAMES are different, but the data TYPE is the same (integers).This is making smoke come outta my ears because I thought that INNER JOINS hadto be "equi JOINs"


  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Field names can be different(althought not the best setup), datatypes need to be the same on joins.

    The joins are
    [a Cust Data].NPI = G_N_TRANS.NPI_ID
    G_N_TRANS.N_P_ID = [REF Mail NIPPS].NAB)

    You can visualize this in the Query Designer. Create new Query, add the 3 tables. Link those tables on those fields and add the Where conditions. Run it to see if data right. Then look at it in SQL code and see how it looks.

  4. #4
    Noob's Avatar
    Noob is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    36
    Hi & THANKS!!!
    Field names can be different(althought not the bestsetup), datatypes need to be the same on joins.

    Yeah I agree not the BEST, but it is what they got. I assumeit is because of the original design of the DBs. That was really killing me tho. Again thanks so much.

    P.S. This is also helpful thanks for sharing:
    You can visualize this in the Query Designer. Create new Query, add the 3 tables. Link those tables on those fields and add the Where conditions. Run it to see if data right. Then look at it in SQL code and see how it looks.

  5. #5
    Noob's Avatar
    Noob is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    36
    One more quick question. What is executed 1st? Would theJOIN in the parentheses be done 1st?



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

Similar Threads

  1. Replies: 3
    Last Post: 08-08-2016, 02:31 PM
  2. Nested Join Help?
    By sab in forum Access
    Replies: 1
    Last Post: 12-16-2011, 05:08 PM
  3. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  4. Help Understanding Join Syntax In Access
    By zephaneas in forum Queries
    Replies: 5
    Last Post: 06-22-2011, 08:32 PM
  5. Nested join problem
    By kman42 in forum Queries
    Replies: 2
    Last Post: 03-25-2011, 02:05 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