Solved

Help with SQL

Posted on 2013-01-02
1
161 Views
Last Modified: 2013-01-02
Hi.
I have a table of login data. Need to find the most recent login by user - return single record for each user - need group by user and most recent login datetime
The data looks this

USER                    DATETIME LOGIN
JOHN                    1/2/2013  1:00
GAYLE                   1/2/2012  9:00
JOHN                    12/31/2012  12:00
GAYLE                   12/31/2012 10:00
BOB                      1/2/2012  12:00


SHOULD RETURN

GAYLE              1/2/2012  9:00
JOHN               1/2/2013  1:00
BOB                1/2/2012  12:00


thx
0
Comment
Question by:JElster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
Steve Wales earned 320 total points
ID: 38736642
select [user], max(datetime_login)
from login_history
group by [user]
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question