sql - Retrieving Online Users By Login and Logout Records -


  • enter image description here

consider userlog table above. save login or logout operation of users table. how can retrieve online users , login time?

something this:

select * userlog l1 operation = 'enter' ,        not exists(select * userlog l2                   l1.user = l2.user ,                         l2.operation = 'exit' ,                         l2.time > l1.time) 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -