Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    hrenee is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    41

    Thank you again. I really appreciate you taking the time, to explain it all to me! I am so bookmarking this page.

  2. #17
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    And, just for general reference, an INNER JOIN can be coded without the JOIN keyword. These two queries are equivalent:
    Code:
    SELECT 
       TS.StaffKey, 
       TS.StaffName, 
       TK.KidKey, 
       TK.Kidname 
    FROM 
       tblStaffnames AS TS
       INNER JOIN 
       tblStaffkids AS TK
       ON TS.StaffKey = TK.KidParent;
    
    SELECT 
       TS.StaffKey, 
       TS.StaffName, 
       TK.KidKey, 
       TK.Kidname 
    FROM 
       tblStaffnames AS TS,
       tblStaffkids AS TK
    WHERE
       TS.StaffKey = TK.KidParent;
    
    StaffKey StaffName  KidKey KidName
    1    George Hamilton  102  Whoopi
    2    Linda Smith      100  Jamie
    2    Linda Smith      101  Kate 
    4    Ernest Borgnine  104  Ernie
    The INNER JOIN syntax is preferred, since it is more explicit, and since the JOIN fields can't accidentally get lost inside a complicated selection criteria.

    If that happens, and someone deletes that join condition from the WHERE, you end up with a CROSS JOIN like this:
    Code:
    SELECT 
       TS.StaffKey, 
       TS.StaffName, 
       TK.KidKey, 
       TK.Kidname 
    FROM 
       tblStaffnames AS TS,
       tblStaffkids AS TK;
     
    StaffKey StaffName  KidKey KidName
    1    George Hamilton  100  Jamie   
    1    George Hamilton  101  Kate    
    1    George Hamilton  102  Whoopi  
    1    George Hamilton  104  Ernie   
    2    Linda Smith      100  Jamie   
    2    Linda Smith      101  Kate    
    2    Linda Smith      102  Whoopi  
    2    Linda Smith      104  Ernie   
    3    Babe Ruth        100  Jamie   
    3    Babe Ruth        101  Kate    
    3    Babe Ruth        102  Whoopi  
    3    Babe Ruth        104  Ernie   
    4    Ernest Borgnine  100  Jamie   
    4    Ernest Borgnine  101  Kate    
    4    Ernest Borgnine  102  Whoopi  
    4    Ernest Borgnine  104  Ernie   
    5    Jane Doe         100  Jamie   
    5    Jane Doe         101  Kate    
    5    Jane Doe         102  Whoopi  
    5    Jane Doe         104  Ernie
    For a parent/kid database, a cross join doesn't have any meaning. On the other hand, a cross join might be useful for some other combination of tables. Say, if you wanted a checklist to make sure that every coach had spent one-on-one time with every player on the team.

  3. #18
    hrenee is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    41
    Thanks again. I'm filing this away for future reference.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Advise needed blank database or blank Web Database
    By Derrick T. Davidson in forum Access
    Replies: 0
    Last Post: 04-25-2013, 09:13 PM
  2. Should Appear Blank
    By gatsby in forum Access
    Replies: 7
    Last Post: 03-26-2013, 12:22 AM
  3. Getting rid of blank labels
    By eskybel in forum Reports
    Replies: 1
    Last Post: 06-28-2012, 07:52 AM
  4. Replies: 4
    Last Post: 05-11-2011, 03:06 AM
  5. Replies: 1
    Last Post: 09-05-2008, 12:07 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