Trying to find MIN or FIRST date

Indigo

Registered User.
Local time
Today, 14:32
Joined
Nov 12, 2008
Messages
241
I am running Access 2003 and I am trying to create a query that will provide me with the first date entered for a particular steel coil serial number. I have a table with over 12,000 records. Everytime a steel coil
is received from the supplier, its serial number and weight along with the date is recorded in this table. Each time the coil is pulled for use and returned to inventory, the new weight is recorded in the table along with the date. I need to create a query that will return only the very first time the coil is entered into the table - by date. Can anyone help?

I have tried:

Code:
SELECT DISTINCT tblReceivedCoilHistory.CoilSerialNumber, First(tblReceivedCoilHistory.DateReceived) AS FirstOfDateReceived, tblReceivedCoilHistory.CoilWeight
FROM tblReceivedCoilHistory
GROUP BY tblReceivedCoilHistory.CoilSerialNumber, tblReceivedCoilHistory.CoilWeight
ORDER BY First(tblReceivedCoilHistory.DateReceived) DESC;

Thanks.
 
Hi

Something like:

Code:
SELECT T.CoilSerialNumber, T.DateReceived, T.CoilWeight
FROM 
 tblReceivedCoilHistory T
INNER JOIN 
 (
    SELECT T2.CoilSerialNumber, Min(T2.DateReceived) AS MinDate
    FROM tblReceivedCoilHistory T2
    GROUP BY T2.CoilSerialNumber
) X
ON T.CoilSerialNumber = X.CoilSerialNumber AND T.DateReceived = X.MinDate
ORDER BY T.DateReceived DESC

Cheers.
 
Works perfectly. Thank you so much!
 

Users who are viewing this thread

Back
Top Bottom