Results 1 to 4 of 4
  1. #1
    bmk450 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    4

    Query to combine two queries


    I feel like this is an easy one but I need some help. I have two queries, each with only two columns
    Query 1: Does a Sum for all the accounts at the airport for each month
    Date Water_Usage
    yyyy-mm 1,234

    Query 2:
    Date Airport_Pass_Volume
    yyyy-mm 1,234,567

    Both tables have the same date and I'm trying to get a new query that combines into three columns: the date, water usage, and passenger volume.

    I've tried dlookup or creating a relationship between the dates but what my new query spits out are rows for each account that is feeding into Query 1.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,712
    Tell us about your tables and fields. Some sample data would also be helpful.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,861
    No idea which table is the "account" table so this is just a guess: change your join to an outer join (all query1 date and query2 dates that match), have date and usage fields from query1 and volume from query2. Another possibility is that the dates don't actually match because you have time values in the date field(s) but have formatted them so that you can't see the time portion. If you think there are identical date values, you can create a test query where you equal join both fields and just return the dates. If no records, they are not the same dates regardless of how they look.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    8,684
    Do you have a field named "Date"?
    Be aware that "Date" is a reserved word in Access and shouldn't be used for object names.
    See Problem names and reserved words in Access
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

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

Similar Threads

  1. SQL: Union Query to Combine 3 Queries
    By pdevito3 in forum Access
    Replies: 6
    Last Post: 06-03-2015, 12:53 PM
  2. Replies: 1
    Last Post: 10-23-2012, 02:04 PM
  3. Combine three queries into one
    By Ray67 in forum Queries
    Replies: 8
    Last Post: 06-13-2012, 11:23 AM
  4. Replies: 5
    Last Post: 08-29-2011, 09:37 AM
  5. Query to combine multiple queries
    By jortizz in forum Queries
    Replies: 4
    Last Post: 05-03-2011, 09:02 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
  •  
Tech Forums: Microsoft Office Forums