D
dan b in st. louis
I'm new to SQL programming and haven't been able to incorporate the
suggestions I've found in other threads, so I apologize for asking a question
that's been answered before. I have a query that pulls data from 2 tables, a
serial number from 1 and a test date and status from another. But for some
serial numbers I've got more than 1 test record (first test was a failure).
I'm looking to keep only the first test record (by date/time) for each s/n.
I've been able to get the "first" test record, but I only get the 1 record,
not 1 for each s/n.
Here is my current query that pulls the s/n, test date and test status.
SELECT dbo_Unit.ModelNo, dbo_Unit.ProductCd, dbo_UnitTest.TestDate,
dbo_Unit.SerialNo, dbo_UnitTest.TestStatus
FROM dbo_UnitTest INNER JOIN dbo_Unit ON dbo_UnitTest.UnitId=dbo_Unit.UnitID
WHERE (((dbo_Unit.ModelNo)="408800-1"))
ORDER BY dbo_UnitTest.TestDate, dbo_Unit.SerialNo;
I appreciate your help in advance.
Dan
suggestions I've found in other threads, so I apologize for asking a question
that's been answered before. I have a query that pulls data from 2 tables, a
serial number from 1 and a test date and status from another. But for some
serial numbers I've got more than 1 test record (first test was a failure).
I'm looking to keep only the first test record (by date/time) for each s/n.
I've been able to get the "first" test record, but I only get the 1 record,
not 1 for each s/n.
Here is my current query that pulls the s/n, test date and test status.
SELECT dbo_Unit.ModelNo, dbo_Unit.ProductCd, dbo_UnitTest.TestDate,
dbo_Unit.SerialNo, dbo_UnitTest.TestStatus
FROM dbo_UnitTest INNER JOIN dbo_Unit ON dbo_UnitTest.UnitId=dbo_Unit.UnitID
WHERE (((dbo_Unit.ModelNo)="408800-1"))
ORDER BY dbo_UnitTest.TestDate, dbo_Unit.SerialNo;
I appreciate your help in advance.
Dan