Results 1 to 3 of 3
  1. #1
    boraz is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2019
    Posts
    1

    Combine Results of Two Queries with Same Fields Except Totals


    I have to queries set up that have the same fields except for the totals. I am wanting to combine these queries so that supplies purchased and supplies used are side by side. For example, I the first record below, all the fields match, so Supplies Purchased = 10,000 and Supplies Used = 5,000 would be side by side. I have tried doing joins on the queries and I have tried doing a union on all the fields except the sums and then joining then left/right joining the queries on the Union results to no avail. It just led to a lot of duplication and high figures.

    Query 1


    Year-Month-Code1-Code2-Code3-Code4-Sum of Supplies Purchased
    2003-01-123-123-123-123-10,000
    2003-02-124-123-123-123-20,000


    Query 2


    Year-Month-Code1-Code2-Code3-Code4-Sum of Supplies Used
    2003-01-123-123-123-123-5,000
    2003-02-124-123-123-123-6,000

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A UNION certainly would not accomplish that, unless you then use the UNION as source for a CROSSTAB.

    Really looks like a compound join on 6 fields.
    Last edited by June7; 01-29-2019 at 12:30 AM.
    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.

  3. #3
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    And I would make all those joins left outer joins just in case some supplies were "purchased" but not "used".

    Cheers,
    Vlad

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

Similar Threads

  1. Replies: 2
    Last Post: 12-24-2014, 09:57 AM
  2. Replies: 1
    Last Post: 05-06-2013, 03:32 PM
  3. Combine Results of Two Queries
    By Ganymede in forum Queries
    Replies: 3
    Last Post: 12-28-2012, 02:00 PM
  4. Replies: 1
    Last Post: 10-23-2012, 02:04 PM
  5. Combine queries results in forms
    By frasilvio in forum Queries
    Replies: 12
    Last Post: 01-10-2008, 01:34 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