Results 1 to 3 of 3
  1. #1
    fionny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Location
    Ireland
    Posts
    7

    Select Distinct Help

    Hi All,



    Another question someone might be able to help with.

    I am doing a select Distinct query on a large table of info. This works perfectly until I add in a specific set of data "Age Group" this is because my Order number can be in multiple age groups. Is there any way of telling Access that I only want 1 instance of each order number and to just take the first value?

    thanks,
    Fionn

  2. #2
    euanl is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Posts
    25
    I would question why you would want to include the age group since you are only wanting to see one instance of the record, thereby making the age group irrelevant.

    If you simply can't live without this field though, you could create a second query that shows the Max or Min value against for the age group against each record and link your query to that. So, let's call your field [Age Group], select that into the query twice, hit the 'totals' icon, leave the first instance of the field as 'Group by', the second as 'Max' (or 'Min' as the case may be). Now in your query link your [Age Group] to the [MaxofAge Group] field in the first query. Hope that makes sense. You may have to add other fields to the first query and link them to make it work right, but I have used a similar method before (with 3 fields linked), which has worked fine so I know it is possible.

  3. #3
    fionny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Location
    Ireland
    Posts
    7
    I do need the field in there for various lookups and counts but yes what you described sounds right, I will try it thanks!

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

Similar Threads

  1. Select distinct
    By Paul-NYS in forum Access
    Replies: 1
    Last Post: 07-09-2012, 09:03 AM
  2. SELECT DISTINCT or equivalent
    By kpo in forum Programming
    Replies: 13
    Last Post: 05-20-2012, 01:45 PM
  3. How to use variable in SELECT DISTINCT
    By celtics11 in forum Access
    Replies: 1
    Last Post: 11-18-2011, 04:28 PM
  4. Replies: 8
    Last Post: 04-21-2011, 05:29 PM
  5. SELECT DISTINCT not working
    By johnmerlino in forum Queries
    Replies: 2
    Last Post: 10-25-2010, 06:48 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