Results 1 to 4 of 4
  1. #1
    Steven Seagal is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2012
    Posts
    20

    How to "combine" the values of two tables?

    Here I have two tables. The first one categorizes items by certain descriptions from a fixed list. Each description, eg; "Big Size" is categorized in the table below with a minutes key. I want to create a table/query that is of the form of the 3rd table. I showed only the first record as an example, replacing minutes with each description.


    Item Size Strength Agility
    A Big Strong Slow
    B Small Strong Fast
    C Small Strong Fast
    D Small Weak Fast
    E Medium Weak Fast
    F Medium Medium Fast
    G Small Medium Medium
    H Big Medium Medium
    Description Type
    Minutes
    Size Small 1
    Size Medium 2
    Size Big 3
    Strength Weak 5
    Strength Medium 2.5
    Strength Strong 1
    Agility Slow 10
    Agility Medium 5
    Agility Fast 0.5


    I want to "combine" these tables to make the table look like this without changing the design of the above two tables. If I MUST change the design of one of the tables, that's fine, just let me know how.
    Item
    Size
    Strength
    Agility
    A 3 1 10


    How would I be able to handle this? I have no idea what type of query I would use or how it would arranged. I'm also pretty stupid at SQL so i probably wouldn't understand too many answers that had a lot of that in them, unfortunately.

    Thanks!

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    There are a few different ways to approach this.
    1. Split your second table into three separate "lookup" tables (one for Size, one for Strength, and one for Agility)
    or
    2. Create three queries (or subqueries) out of your second table (one for Size, one for Strength, and one for Agility, using the Description code as the Criteria for each one to limit it just to that particular description).

    So, then you have three queries (or tables), one for each Description. Then create a new query, linking the three new queries (tables) to your original table.
    The first one would link your Size query (table) to the original table by joining the Type field in the Size query (table) to the Size field in your main table.
    Repeat for the other two, joining on the appropriate fields.

    Then you can return the values you need.

  3. #3
    Steven Seagal is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2012
    Posts
    20
    This really set me on the right track! Thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    I'm with JoeM with choice 1. What you're attempting looks like what's often called the One True Lookup Table. While it has its proponents, I think the consensus is that it's better to have individual tables.

    Edit: am I a slow typist or what!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  2. Replies: 3
    Last Post: 11-15-2011, 02:41 PM
  3. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  4. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  5. Replies: 4
    Last Post: 12-03-2010, 04: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