求出最近一次登陆信息,要去掉重复人只能出现一次
select T.* from (select name,MAX(logintime) logintime from T group by name) maxT join T on maxT.name = T.name,maxT.logintime = T.logintime
百度 :sql分组取第一
sql 关键字 distinct 去重,然后根据LoginTime排序,之后去第一条
select Name,MAX(logintime) from tab group by Name
select distinct top 1 * from (表名) order by loginTime desc
select * from lll where da in (select MAX(da) as 结果 from lll group by name) order by name desc