I want to calculate the time spent by user on our system. In logs table we track currently login time but we don't have logout time logged currently. So to find out time spent by user in a session I want to find out difference between two login events
For example user has logged in multiple times on 2022-02-16 so I have to calculate the time difference between two login events. How we can achieve in that SQL Server? I have to do this inside a view, so can not use any temp tables or SP