Looking for a Query Wizard

T

TwinDad

Hello all,

I need help with a query that will look for the first record and a last
record of a group. I tried the DFirst and DLast. Is this what I should use?
and if so can someone show me some examples.

the table has "TimeIn" and I need a First & Last For each individual
RouteNumber in my Table "Tbl_Reefer_Tracking".

Any Help is Greatly Appreciated,

Charlie
 
J

Jerry Whittle

It's enough to drive someone to reefer madness! DFirst, First, DLast, and
Last are all about worthless unless the recordset is sorted first. Assuming
that the TimeIn field is an actual date/time datatype, Min and Max are much
better.

SELECT Tbl_Reefer_Tracking.RouteNumber,
Min(Tbl_Reefer_Tracking.TimeIn) AS MinOfTimeIn,
Max(Tbl_Reefer_Tracking.TimeIn) AS MaxOfTimeIn
FROM Tbl_Reefer_Tracking
GROUP BY Tbl_Reefer_Tracking.RouteNumber;
 
T

TwinDad

Jerry, Thanks! It worked exactly like I what I was looking for.

Thanks again,

Charlie
 
Top