Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @ ArviLaanemets,


    Good catch, thanks. I must of looked at that 10 times and still missed it ..... it was at 1:00 am.
    The perils of being tired and copy and pasting.

    Yes, it should have been

    jnctPlayersGames
    -----------------
    PlayerGameID_PK Autonumber
    PlayerID_FK Number - Long Integer (Link to Player table)
    GameID_FK Number - Long Integer (Link to Games table)
    (other fields as desired)

  2. #17
    Svenne is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    10
    Quote Originally Posted by ssanfu View Post
    @ ArviLaanemets,
    Good catch, thanks. I must of looked at that 10 times and still missed it ..... it was at 1:00 am.
    The perils of being tired and copy and pasting.

    Yes, it should have been

    jnctPlayersGames
    -----------------
    PlayerGameID_PK Autonumber
    PlayerID_FK Number - Long Integer (Link to Player table)
    GameID_FK Number - Long Integer (Link to Games table)
    (other fields as desired)
    Thanks all of you. But I am not sure I understand. If I have the following fields for the players: FirstName, LastName and BirthYear; how could the programme then know what persons who practises both sports?

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    @Svenne

    Every table in a relational database should have a Primary Key. The purpose of the PK is to uniquely identify records in that table.

    The PlayerPK identifies each Player. The GameID (or SportID) identifies each Game/Sport.
    These are separate things , so separate tables.
    Your requirement is to show which Player, participates in which Game (I call it Sport). This requires a junction table, since a player may participate in more than 1 Game/sport and a Game/Sport could be the choice of many Players.

    Consider
    Players
    PlayerId- PlayerName
    1--Jim
    2-John
    3-Sam

    Games/sport
    1-Baseball
    2-Skiing
    3-Hockey
    4-Soccer

    Junction PlayerParticipatesIN

    John participates in Hockey and Soccer
    Sam participates in Soccer
    Jim participates in Baseball, Skiing and Soccer

    the junction table

    PlayerID--------GameID
    1.......................1===========Jim Baseball
    1.......................2===========Jim Skiing
    1.......................4===========Jim Soccer
    2.......................3===========John Hockey
    2.......................4===========John Soccer
    3.......................4===========Sam Soccer

  4. #19
    Svenne is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    10
    Thanks for all the replies. One final question. In the jnct (other fields as desired). I am not sure I understand. What other fields?

    Again many thanks.


    Quote Originally Posted by orange View Post
    @Svenne

    Every table in a relational database should have a Primary Key. The purpose of the PK is to uniquely identify records in that table.

    The PlayerPK identifies each Player. The GameID (or SportID) identifies each Game/Sport.
    These are separate things , so separate tables.
    Your requirement is to show which Player, participates in which Game (I call it Sport). This requires a junction table, since a player may participate in more than 1 Game/sport and a Game/Sport could be the choice of many Players.

    Consider
    Players
    PlayerId- PlayerName
    1--Jim
    2-John
    3-Sam

    Games/sport
    1-Baseball
    2-Skiing
    3-Hockey
    4-Soccer

    Junction PlayerParticipatesIN

    John participates in Hockey and Soccer
    Sam participates in Soccer
    Jim participates in Baseball, Skiing and Soccer

    the junction table

    PlayerID--------GameID
    1.......................1===========Jim Baseball
    1.......................2===========Jim Skiing
    1.......................4===========Jim Soccer
    2.......................3===========John Hockey
    2.......................4===========John Soccer
    3.......................4===========Sam Soccer

  5. #20
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Other fields as desired means
    --If you have other fields that are dependent on this composite key, then this is where they would be recorded.

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

Similar Threads

  1. need to compare two tables
    By ZeroWard in forum Access
    Replies: 1
    Last Post: 02-01-2016, 10:26 AM
  2. Compare two tables
    By hoachen in forum Queries
    Replies: 2
    Last Post: 08-11-2015, 06:09 PM
  3. Replies: 5
    Last Post: 05-23-2012, 04:20 AM
  4. Compare records in 2 tables
    By RalphJ in forum Access
    Replies: 13
    Last Post: 03-06-2011, 07:43 AM
  5. Compare two tables
    By Igli in forum Access
    Replies: 2
    Last Post: 07-05-2010, 10:30 AM

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