Results 1 to 3 of 3
  1. #1
    garamon is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5

    return max/min value in single query


    I have a table listing employee names and their birthdates. I have to create a single query that returns the names of the oldest employee and youngest employee. it's easy to return only their birthdays, but i can't figure out how to return the names (with or without their birthday). I can only use a single wuery.

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Assume all are info is in Table1, Names are in Name1 and Birthdays are in Date1, then your query would look like this:

    Code:
    SELECT Table1.ID, Table1.Name1, Table1.Date1
    FROM Table1
    WHERE (((Table1.Date1)=(Select Max (Date1) from Table1))) OR (((Table1.Date1)=(Select Min (Date1) from Table1)));
    This query will return the oldest and youngest.

  3. #3
    garamon is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5
    thank you so much!!

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

Similar Threads

  1. Exporting single query and single report.
    By rfhall50 in forum Programming
    Replies: 2
    Last Post: 02-18-2011, 12:08 PM
  2. Return all records from Query
    By ysrini in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 09:52 PM
  3. Query to display in single row
    By access in forum Queries
    Replies: 10
    Last Post: 01-14-2010, 11:40 AM
  4. Multiple UPDATE in single query
    By nishezaman in forum Access
    Replies: 0
    Last Post: 12-13-2009, 01:40 AM
  5. Return Record # In Query
    By redwinger354 in forum Access
    Replies: 1
    Last Post: 09-15-2007, 01:08 PM

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