I’m using MySQL 5.5.37. I’m having trouble writing a query. I have the following columns of data …
select distinct u.id, u.first_name, u.last_name, l.last_login_time …
What I want is to select one row where the first name and last name are unique per the most recent last_login_time. So if the above query returns
ID FIRST_NAME LAST_NAME LAST_LOGIN_TIME
=============================================
100 Jerry Seinfeld 2015-07-01
200 George Costanza 2014-01-01
300 Jerry Seinfeld 2015-07-31
400 George Costanza 2015-05-05
500 Elaine Benes 2013-03-03
I would want my modified query to return
ID FIRST_NAME LAST_NAME LAST_LOGIN_TIME
=============================================
300 Jerry Seinfeld 2015-07-31
400 George Costanza 2015-05-05
500 Elaine Benes 2013-03-03
Any ideas how I would write such a query?