• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Help with SQL

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


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

1 Solution
Steve WalesSenior Database AdministratorCommented:
select [user], max(datetime_login)
from login_history
group by [user]
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now