How to find maximum concurrent users and sessions by Login and Logout Time?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DSal
    New Member
    • Jun 2018
    • 1

    How to find maximum concurrent users and sessions by Login and Logout Time?

    I am trying to figure out the solution using co-related sub-query but somehow getting stuck with 'odd-dates' instead of # of max(concurrent users) and sessions for particular applications. Any help would be really appreciable.

    Below is the reference query and output snapshot:-

    SELECT ExtensionID, ClientCode, LoginTime, LogoutTime
    FROM ( SELECT ExtensionID, ClientCode, AuditDate as LoginTime, Change, isnull(LEAD(Aud itDate) OVER (PARTITION BY ExtensionID ORDER BY AuditDate), GETDATE()) as LogoutTime
    FROM (SELECT ExtensionID, ClientCode, AuditDate, case when AssignedEmploye eID is not null then 1 when AssignedEmploye eID is null then -1 else 0 end as change
    from Focus.Mallaka.T ollExtensions as ext with (nolock)
    WHERE AuditDate between DATEADD(Day,-7,GETDATE()) and GETDATE()
    ) as subQ
    ) as LeadSubQuery
    WHERE Change = 1
    order by ExtensionID, LoginTime;
    Attached Files
Working...