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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -