473,395 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

1
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(AuditDate) OVER (PARTITION BY ExtensionID ORDER BY AuditDate), GETDATE()) as LogoutTime
FROM (SELECT ExtensionID, ClientCode, AuditDate, case when AssignedEmployeeID is not null then 1 when AssignedEmployeeID is null then -1 else 0 end as change
from Focus.Mallaka.TollExtensions 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 Images
File Type: png SQLOutput_050618.PNG (9.8 KB, 90 views)
Jun 6 '18 #1
0 2225

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave Kissoondoyal | last post by:
We are running three web sites in a clustered environment WLBS. The web servers are connected to a Database Server running MS SQL server enterprise edition licensed as per CPU license. The Windows...
3
by: mgPA | last post by:
Short: How can I limit the number of concurrent logins to Access (2000) DB? Long: I seem to be having the problem discussed in previous postings of having more than 9 or 10 concurrent logins. ...
8
by: pnp | last post by:
Hi all, I've developed a win C# app that is actually database driven using SQL server 2000. The idea is that only one application will be installed on a server in a network and the program will be...
4
by: Ollie | last post by:
Is there anyway to montior the number of user sessions from an asp.net app\page? The reason I ask is because I would like to throttle the number of concurrent sessions to a website, i.e. limit...
6
by: Bill Manring | last post by:
I have an ASP.NET application which my company sells comercially. We license on a concurrent user model, but we currently rely on the "honor" system for the customers to give us their best guess...
3
by: kashok | last post by:
hi, how to track users login/logout time on our site and store it in database Thank U Ashok
5
by: samatair | last post by:
I am using sessions to maintain login/logout status. I update the table when a user logs in and logs out. But some users don't logout. How to automatically log them out and update the status. I had...
1
by: naveenkongati | last post by:
Hi, My application is designed under MVC2 architecture which includes JSP,Servlet,DAO and bean. In this application i am tracking a user login details into a table. When user logs out i am...
1
by: ankit pahuja | last post by:
how to find count of the how many users are login code in php
0
by: mannaD | last post by:
Hi guys, i am writting this vb.net 2012 program connected to local sql databse that is to track the time in which a staff comes to work for that day and time in which he/she close for that day by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.