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

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -