Results 1 to 2 of 2
  1. #1
    awap87 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    May 2017
    Posts
    3

    Return Min value for criteria

    Hi,

    I'm looking for some help with a custom column I'm looking at adding to my database please.

    Let's say I have a query with that returns the following data:

    John Doe (name), 30 (age)
    John Doe (name), 34 (age)
    Jane Smith (name), 31 (age)

    Is there anyway to add a column on the end that will return the Min age for each name?

    So, the desired output would be:

    John Doe (name), 30 (age), 30 (Min age for this name)
    John Doe (name), 34 (age), 30 (Min age for this name)
    Jane Smith (name), 31 (age), 31 (min age for this name)

    There may be other criteria this will be based on, but I'll keep it simple for now.

    For this particular part, for one reason or another, grouping by name isn't an option.

    Does anyone know any way to do this at all?



    Many thanks!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,841
    something like

    SELECT T.*, S.MinAge
    FROM myTable T INNER JOIN (SELECT name, min(age) AS MinAgeFROM myTable GROUP BY Name) S ON T.name=S.Name
    Order BY T.Name, T.Age

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

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2017, 04:59 PM
  2. How do I return a value on multi criteria?
    By smc678 in forum Access
    Replies: 5
    Last Post: 11-20-2012, 02:35 PM
  3. Replies: 3
    Last Post: 08-15-2011, 10:06 AM
  4. Dlookup to match two criteria and return value
    By randolphoralph in forum Programming
    Replies: 20
    Last Post: 05-20-2010, 12:27 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