Results 1 to 4 of 4
  1. #1
    katyshuler is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    2

    Need Join Help?

    I must be having a brain fart, but I can't figure out how to do this. First off, I'm not very good at Access, but very good at SQL.

    Table: DATABASE
    Fields: Type1, Type2, Type3, Type4, Type5 (only Type1 is required, others are mostly blank)
    ...Joined to...
    Table: WORKDESCRIPTION
    Fields: CMCS_Code

    Each record in WORKDESCRIPTION has a cost.

    I'm creating an invoice (using a query which joins the two above tables) and want to generate a cost for each value in Types 1-5, but I can only get it to pull the first cost. I'm assuming I'm going to need to run a CAST AS statement, but for the life of me I can't figure out how to write it. Any help would be greatly appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    If you're saying the WORKDESCRIPTION table has to join to each of the Type fields (not a normalized design by the way), you'd join 2-5 to aliased copies of the table. You might prefer creating a UNION query to "normalize" the first table, then your join is a simple one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    katyshuler is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    2
    A UNION query is only valid if the table has all the same fields. Let me explain it differently.

    ORDER table has a spot for 5 items.
    ITEMS table has all items listed and their price.

    I need ORDER.ITEMID to link to ITEMS.ID to pull the price of each item, so I can display it on a report (invoice).

  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,641
    I meant to UNION the order table to normalize it, then a regular query joining that to the items table. Or leave it like it is and use aliases of the items table.
    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: 6
    Last Post: 11-19-2013, 01:38 AM
  2. Inner Join works but not Left Join
    By kwooten in forum Queries
    Replies: 1
    Last Post: 12-11-2012, 05:09 PM
  3. Many-to-Many Self Join
    By brharrii in forum Database Design
    Replies: 2
    Last Post: 09-21-2012, 09:24 AM
  4. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  5. SQL - Inner Join
    By springboardjg in forum Queries
    Replies: 1
    Last Post: 05-12-2011, 05:10 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