Results 1 to 2 of 2
  1. #1
    keith2511 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2017
    Location
    UK
    Posts
    45

    Spurious result in multi table query

    I have a scenario where I process data in two tables and extract certain fields into a third table for exporting to Excel.


    The tables "apples costs " and "apples_export" have one record per ODS whereas table "apples vmp import" could have several records per ODS.


    The query below is a check that the values before processing remain unaltered in the export file.


    Code:
     SELECT Sum([apples_export].[Avg_Discounted_Total]) AS Export_Avg_Discounted_Total, Sum([apples costs import].[Avg_Discounted_Total]) AS Import_Avg_Discounted_Total1, Sum([apples_export].[Avg_Disc_CatC]) AS Export_Avg_Disc_CatC, Sum([apples vmp import].[Average_Disc_CatC]) AS Import_Average_Disc_CatCFROM (apples_export INNER JOIN [apples costs import] ON apples_export.ODS = [apples costs import].ODS) INNER JOIN [apples vmp import] ON apples_export.ODS = [apples vmp import].ODS;

    However the result of the query gives a spurious figure for the "Export_Avg_Disc_CatC" as the table actually contains £55,017.16 (see picture).


    I've never created a query based on multiple tables before, where am I going wrong?


    Click image for larger version. 

Name:	Picture1.png 
Views:	16 
Size:	22.4 KB 
ID:	51336

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Can you post up a picture of the relationships between the three tables.
    From you description I don't know why you would need the third table "apples vmp import" in the query at all?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Replies: 9
    Last Post: 09-22-2022, 03:12 AM
  2. Junction table creates spurious "one-side" records
    By William Royce in forum Database Design
    Replies: 6
    Last Post: 01-13-2020, 08:22 AM
  3. Replies: 3
    Last Post: 08-18-2018, 01:29 PM
  4. Replies: 1
    Last Post: 02-18-2013, 02:55 AM
  5. Replies: 14
    Last Post: 02-25-2012, 02:59 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