#不同日期会对应不同的设备。
#本题中用户ID和日期可以确定唯一记录,所以多表关联+where过滤(用户ID,日期)
select u.name as u_n ,c.name as c_n ,l.date from login l join user u on l.user_id=u.id join client c on l.client_id=c.id where (l.user_id,l.date)in (select user_id,max(date) from login l group by l.user_id) order by u_n;