Results 1 to 3 of 3
  1. #1
    dancoe2004 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    1

    Lightbulb Query Duplication

    I have a query which is designed to combine two tables, volumes and prices. Each record should then show the price and volume at an airport per month. An airport can have multiple records per month if there are either multiple airlines operating to the airport or multiple suppliers offering a price.

    The issue is that where an airport has multiple airlines for a month this creates duplicates. If there are 2 airlines then each record is repeated twice giving 4 records, if there are 5 airlines then there are 25 records. The same thing doesn't happen where there are multiple suppliers however. I'm stumped.



    I do have a very limited understanding of SQL but this query was put together using the design view. The SQL is below, any help would be gratefully received.


    SELECT [Actual Volumes].Country, [Actual Volumes].Airport, [Actual Volumes].Airline, Prices.[Supplier code], Prices.[%], [Actual Volumes].Date, [Actual Volumes].[Fuel Uplift USG], [Actual Volumes].[Sector Count], [Fuel Uplift USG]*[%]/100 AS [Supplier Volume], [Sector Count]*[%]/100 AS [Supplier Sectors]
    FROM [Actual Volumes] INNER JOIN Prices ON ([Actual Volumes].Date = Prices.Date) AND ([Actual Volumes].Airport = Prices.Airport);

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    it depends on your data layout.
    you can query setting the property UNIQUE VALUES = true
    to remove the dupes.
    then count using THAT query so you dont involve the duplicates.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You have spaces in your object names - should never use spaces.

    "Date" is a reserved word - should never use reserved words as object names.

    "%" is an extremely bad object name.

    Some suggestions:
    Use only letters and numbers (exception is the underscore) for object names.
    Do not use spaces, punctuation or special characters in object names.
    Do not use look up FIELDS, multi-value fields or calculated fields in tables.
    Do not begin object names with a number.

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

Similar Threads

  1. Append query without duplication
    By ChobeyGuddu in forum Access
    Replies: 2
    Last Post: 01-24-2017, 04:42 AM
  2. Duplication of data
    By Nixx1401 in forum Reports
    Replies: 1
    Last Post: 12-12-2011, 10:05 PM
  3. Query Duplication
    By Lois in forum Queries
    Replies: 1
    Last Post: 11-22-2011, 08:47 AM
  4. Query duplication issues
    By MiCCAS in forum Queries
    Replies: 1
    Last Post: 02-18-2010, 11:31 AM
  5. duplication
    By noidea in forum Access
    Replies: 1
    Last Post: 07-31-2009, 06:22 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