Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Based on Date and Item

Status
Not open for further replies.

Jtrim52

Technical User
Feb 18, 2007
2
US
I am trying to track railcar activity. I have daily entries by railcar number and date. I want to list only the lastest date for each railcar. For example I have 102 cars to track. There are 900 entries, and I just want to list one record per car that shows the last date for that car.

 
Hi, Jtrim52,

Have a look at the DMax function. Or in your query you may use the Top keyword.

Ken S.
 
How are ya Jtrim52 . . .

You need a [blue]Totals[/blue] query, the SQL of which is something like:
Code:
[blue]SELECT Count(ID) AS CntID, RailCarNum, Max(RailDate) AS MaxDate
FROM tblRailcars
GROUP BY RailCarNum;[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top