Query help

  • I've attached table schema and some sample data. Need to find out when user logged in, when he logged out and how long did he stay in the app. Also, sometimes user doesn't log out. At that time he stayed on the app will be null.

  • Couple of things ... someone just asked this question on here... (answered maybe 15 minutes ago), and your INSERTS don't work.

    if you use ROW_NUMBER() and partition by the UserID column and the date, you should get pairs of login/out. if you use ROW_NUMBER() on that, the evens are IN, the odds are OUT.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply