Solved

Help with SQL

Posted on 2013-01-02
1
157 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
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now