Results 1 to 5 of 5
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    Can't figure out the best way to join queries

    Hey guys,



    I have 2 queries made, and work perfectly. 1 shows a salespersons total amount sold in each category (bedding and furniture), the other shows the amount sold in each category that has the extended warranty also sold on it (dubbed "covered").

    For instance: a salesperson sales a $200 sofa to customer A, and a $300 sofa with the extended warranty to customer B. His total would be $500 and covered would be $300. These queries are used to calculate warranty sales percentage.

    Only recently did we split into the bedding and furniture sub-categorys ("sub" meaning underneath the "covered" and "total"). I have been trying to modify the original queries/tables/reports to work with the new system. I am on pretty much on the final query but I can't figure out how to join the queries up now. I keep getting multiple records, but not necessarily duplicates. Pic attached:
    Click image for larger version. 

Name:	query.PNG 
Views:	7 
Size:	30.5 KB 
ID:	15667
    The top query is the one where I am trying to join them, middle is covered, and bottom is total. "Bucket" is the category. For the highlighted salesperson, the top query should have only 2 records:
    Total _______Covered_________ Bucket
    1579.75______1028.50_________Bedding
    24033.33_____5089.21_________Furniture

    Every salesperson will be in the Total query, but only ones that sold at least $1 in extended warranty will show up in the covered query. So I have an outer join on "SLSP" going from total to covered. (did I say that right? The join arrow points towards the covered query).


    How can I get this to work correctly?

    Thanks guys

  2. #2
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Don't know if this helps you, but:
    Attachment 15668

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    snipe,

    I get an invalid link on the attachment

    How about posting the SQL for each.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    This is expected with one-to0-many joins, especially if there is more than one 'many' table in the query. Either summarize data with aggregate queries then join the summary datasets to a master dataset of all categories. Or build report with subreports.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Ah that worked. Made the 2 base queries into 4 queries. Works perfectly. Appreciate it June7.

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

Similar Threads

  1. Union query to join two crosstab queries
    By racefan91 in forum Queries
    Replies: 5
    Last Post: 09-26-2013, 10:24 AM
  2. Replies: 17
    Last Post: 08-27-2013, 10:21 PM
  3. Replies: 7
    Last Post: 09-06-2012, 06:04 AM
  4. JOIN Two Queries
    By rickn in forum Access
    Replies: 2
    Last Post: 07-12-2010, 02:42 PM
  5. Join queries that do not have matching field
    By Petefured in forum Queries
    Replies: 2
    Last Post: 05-04-2010, 11:19 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