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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to query latest dates for multiple records in table 1

Status
Not open for further replies.

medici

MIS
Mar 26, 2003
4
0
0
US
I have a table (UserLogons) containing logon records from five domain controllers. Each user (UserName) in the domin will have one record from each DC, including the last logon date (LastLogon) for that particular DC (which may be empty if a particular user was never authenticated by a particular DC). So each particular user will have a total of five rows in the table.

I need to produce a filtered list with ONE row per UserName, showing the most recent LastLogon date only, irregardless of which DC might have been used.

Any ideas on how to do this?
 
select UserName,max(LastLogon)
from UserLogons
group by UserName
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top