paddgirl21
Registered User.
- Local time
- Today, 15:45
- Joined
- Dec 6, 2010
- Messages
- 11
Hi guys,
I have a problem. I have gotten quite far with my Access database with ONE thing left to do. And I have hit a wall.
To give you a background on it:
I have made a query with a subquery that will find the duplicates (based on SSN) of the test results and only display those people who have come in before and were tested by a certain company on a certain date. PHEW!
My problem comes when I try to compare a person's recent test results with those of a previous test result. I want to show only those people who have a difference of 10 degrees or more between the two tests.
Example:
Joe came in for two tests in his lifetime. First test revealed the following results: 5,10,5,15
Second test revealed: 20,20,15,15
So, according to my report that I will generate, he should show up on this with an explanation of how much of a difference was between the two tests only if it was a difference of 10 or more.
Test2 Test1, Result
20-5=15
20-10=20
15-5=10
15-15=0
Right now it is displaying all those who have come in on a certain date who were in previously even if there was not a noticable difference.

Here is my current Query that is working good so far:
SELECT TestRecords.SSN, TestRecords.TestDate, TestRecords.L500, TestRecords.L1K, TestRecords.L2K, TestRecords.L3K, TestRecords.L4K, TestRecords.L6K, TestRecords.L8K, TestRecords.TestNumber, EmployeeInfo.LastName, EmployeeInfo.FirstName, EmployeeInfo.MI, EmployeeInfo.DOB, TestRecords.R500, TestRecords.R1K, TestRecords.R2K, TestRecords.R4K, TestRecords.R6K, TestRecords.R8K, TestRecords.R3K
FROM (EmployeeInfo INNER JOIN TestRecords ON EmployeeInfo.SSN = TestRecords.SSN) INNER JOIN [EmployeesByTestDate&Comp] ON EmployeeInfo.SSN = [EmployeesByTestDate&Comp].SSN
WHERE (((TestRecords.SSN) In (SELECT [SSN] FROM [TestRecords] As Tmp GROUP BY [SSN] HAVING Count(*)>1 )))
ORDER BY TestRecords.SSN;
If you need more information, please let me know. I am so stuck right now!!
Please someone give me some light into my situation.
Thank you!
I have a problem. I have gotten quite far with my Access database with ONE thing left to do. And I have hit a wall.
To give you a background on it:
- The database stores people's testing results
- It has two tables: One with the person's information and another with everyone's test results stored with according to their SSN
- The tables are joined via a relationship of their social security number
- In the test records table, there are multiple fields for each of the different level of tests, including a test date, and the test number. Some people over their lifetime will end up coming in for multiple tests, with varying test dates, test numbers, and test results.
I have made a query with a subquery that will find the duplicates (based on SSN) of the test results and only display those people who have come in before and were tested by a certain company on a certain date. PHEW!

My problem comes when I try to compare a person's recent test results with those of a previous test result. I want to show only those people who have a difference of 10 degrees or more between the two tests.
Example:
Joe came in for two tests in his lifetime. First test revealed the following results: 5,10,5,15
Second test revealed: 20,20,15,15
So, according to my report that I will generate, he should show up on this with an explanation of how much of a difference was between the two tests only if it was a difference of 10 or more.
Test2 Test1, Result
20-5=15
20-10=20
15-5=10
15-15=0
Right now it is displaying all those who have come in on a certain date who were in previously even if there was not a noticable difference.

Here is my current Query that is working good so far:
SELECT TestRecords.SSN, TestRecords.TestDate, TestRecords.L500, TestRecords.L1K, TestRecords.L2K, TestRecords.L3K, TestRecords.L4K, TestRecords.L6K, TestRecords.L8K, TestRecords.TestNumber, EmployeeInfo.LastName, EmployeeInfo.FirstName, EmployeeInfo.MI, EmployeeInfo.DOB, TestRecords.R500, TestRecords.R1K, TestRecords.R2K, TestRecords.R4K, TestRecords.R6K, TestRecords.R8K, TestRecords.R3K
FROM (EmployeeInfo INNER JOIN TestRecords ON EmployeeInfo.SSN = TestRecords.SSN) INNER JOIN [EmployeesByTestDate&Comp] ON EmployeeInfo.SSN = [EmployeesByTestDate&Comp].SSN
WHERE (((TestRecords.SSN) In (SELECT [SSN] FROM [TestRecords] As Tmp GROUP BY [SSN] HAVING Count(*)>1 )))
ORDER BY TestRecords.SSN;
If you need more information, please let me know. I am so stuck right now!!

Thank you!