Results 1 to 3 of 3
  1. #1
    epardo87 is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    101

    Query Duplicating Results


    Hello,

    I've created a DB a while ago and I'm quite rusty on access these days, turns out that the query is returning duplicated values, I remember having read that the INNER JOIN might have something to do with it, but can't remember how to fix it, here is the SQL,

    I'd appreciate any help provided

    Code:
    SELECT [tbl-Pretemp].Tiempo, [tbl-Pretemp].Alimento, [tbl-Pretemp].Gramos, [tbl-Pretemp].Día, [tbl-Pretemp].Paciente, NUTR_DEF.Nutr_No, NUTR_DEF.NutrDesc, NUT_DATA.Nutr_Val, NUTR_DEF.Units, [Nutr_Val]*[Gramos]/100 AS [N utr_PP], NUTR_DEF.Rep
    FROM NUTR_DEF INNER JOIN (((FOOD_DES INNER JOIN [tbl-Pretemp] ON FOOD_DES.NDB_No = [tbl-Pretemp].Alimento) INNER JOIN WEIGHT ON FOOD_DES.NDB_No = WEIGHT.NDB_No) INNER JOIN NUT_DATA ON FOOD_DES.NDB_No = NUT_DATA.NDB_No) ON NUTR_DEF.Nutr_No = NUT_DATA.Nutr_No
    WHERE ((([tbl-Pretemp].Paciente)=[forms]![frm-DietProgram]![txtUserID]) AND ((NUTR_DEF.Rep) Like "1"));
    Regards!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Change the join type in the query design and see what happens. In the designer, click on the line that links the tables to open the Join Properties dialog.
    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
    John_G is offline VIP
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What do you mean by "duplicate values" in this context? Do you mean entire lines in the query results are duplicated (i.e. ALL the fields are the same), or just some fields?

    The former (all fields duplicate) is unusual, but can happen (usually indicates a data error somewhere), but the latter (partial duplication) is perfectly normal any time a one-to-many relationship exists between tables in the query.

    Can you clarify, please?

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

Similar Threads

  1. Append query duplicating records
    By thart21 in forum SharePoint
    Replies: 2
    Last Post: 11-08-2017, 12:16 PM
  2. Is my duplicate query duplicating results?
    By rebfein in forum Queries
    Replies: 5
    Last Post: 09-11-2017, 12:23 PM
  3. Duplicating results from my query
    By AccessNovice16 in forum Queries
    Replies: 4
    Last Post: 05-18-2017, 01:08 PM
  4. Query is duplicating values
    By epardo87 in forum Access
    Replies: 3
    Last Post: 01-26-2017, 06:21 PM
  5. Duplicating data in query
    By thart21 in forum Queries
    Replies: 3
    Last Post: 04-07-2011, 10:50 AM

Tags for this Thread

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