Results 1 to 7 of 7
  1. #1
    Tom1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    13

    Duplicate results when using Min in total section of query

    I am recieving duplicate entries from a table in my query using the Min option in total section.



    I have a table with a list of styles and unique numbers eg
    Style Number
    1234 104501
    1234 104502
    1234 104503
    4321 109701
    4321 109702

    In a query prior to the main query I am saying that I want the 'number' for 2 records of style 1234, this information is inputted through a form linked to a seperate table.

    The main query, using 'Min' in totals, this is pulling out results for 2 records of style 1234 but it showing number 104501 for both records. I need it to show 104501 for the first record and 104503 for the second record.
    It is important that it picks the lowest number first, and I have to be able to select more than 1 entry of the same style at the same time, so i can't just say give me result for 1 'number' for style 1234 and 1 'number' for style 4321. In the SQL view I have added DISTINCT after select.

    Any ideas how I can get the query to display the information I require.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I am a bit confused as to what you are after. So, the data you posted is what you are starting with? Based on that sample, what would you like your expected results to look like?

  3. #3
    Tom1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    13
    Yes, the data I posted is what data has been entered into the table. In the query, I need to retrieve the two lowest numbers from 'number' field for a given 'style', in this example I am using 'style' 1234.
    My query at the moment displays the following information -
    Style Number
    1234 104501
    1234 104501

    I need the query to display

    Style Number
    1234 104501
    1234 104502

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Maybe this method is what you are looking for: http://support.microsoft.com/kb/210039

  5. #5
    Tom1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    13
    Thank you for the link, I'm just working through that formula now. I'll let you know how it goes....

  6. #6
    Tom1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    13
    Joe,
    That formula's worked great. Thanks for the help!

  7. #7
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your welcome! Glad it worked out for you.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  2. Total Query
    By joannakf in forum Queries
    Replies: 1
    Last Post: 12-22-2011, 05:35 PM
  3. Query Brings back duplicate results
    By DaveyJ in forum Queries
    Replies: 1
    Last Post: 06-10-2010, 05:59 PM
  4. Suppressing duplicate results
    By jonesy29847 in forum Reports
    Replies: 5
    Last Post: 04-22-2010, 12:43 PM
  5. Replies: 26
    Last Post: 11-06-2009, 10:16 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