Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7083891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:14:04+00:00 2026-05-28T07:14:04+00:00

I am working on a project with MS Access 2010. A person with an

  • 0

I am working on a project with MS Access 2010.

A person with an illness needs to matched against two people without the illness, or controls. These two controls need to be the nearest in terms of age as possible.

I have matched suitable controls but I am struggling to make a query to select just the two controls with nearest dates of birth (Date difference) to the people with the disease.

(The date_difference field is an absolute number so even if they are younger or older the number is always positive – obviously, a higher number indicates they are more years apart).

Can anyone help?

For example… (obviously all names are completely made up!)

For example…

I would like the outcome of a query to generate the following:

output

Any help will be MUCH appreciated!

James

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:14:04+00:00Added an answer on May 28, 2026 at 7:14 am

    I hope the whole table set-up is imaginary.

    SELECT b.id,
           b.disease_id,
           b.disease_surname,
           b.control_id,
           b.control_surname,
           b.date_difference
    FROM   controls AS b
    WHERE  b.id IN (SELECT TOP 2 id
                    FROM   controls a
                    WHERE  a.disease_id = b.disease_id
                    ORDER  BY date_difference) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project and need to access a label from a normal
I am working on a database access layer project and decided to use Linq
I'm working on a project that uses Linq2SQL for data access. The project is
I am working a project where I need to generate a series of classes
I am at the moment working on a project on Visual Studio 2010 using
I am working on a project with the following conditions: Visual Studio 2010 ASP.NET
I am working on project where I have to access SharePoint data in C#.
I'm working on a project using jsp and Microsoft Access. There are three tables
I'm currently working on a project which uses many ajax requests to access data
I'm currently working on a project that uses data access on different databases. Our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.