select * from AdminUser a left join AdminLogs b on a.uUserName=b.[LogUserName]
where not exists ( select 1 from AdminLogs where [LogUserName]=b.[LogUserName] and [Logintime]>b.[Logintime] )
一对多两表关联,多的那个只要最新一条记录
最新推荐文章于 2023-08-17 16:29:33 发布
select * from AdminUser a left join AdminLogs b on a.uUserName=b.[LogUserName]
where not exists ( select 1 from AdminLogs where [LogUserName]=b.[LogUserName] and [Logintime]>b.[Logintime] )