Hi,
I am creating a report for which i need to query a table for total number of users and Concurrent users logged in.
The table will contain Username(nvarcar,not null),SessionStart time(datetime, not null), SessionEnd time (datetime,null), SessionID(int,not null) and ConnectGUID(uniqueidentifier, not null) etc
can any one help me in finding total and number of concurrent logins per day.
Sample Data
Username --- Starttime --- Endtime --- SessionID
FW8126 --- 26/06/2007 00:36:34 --- 26/06/2007 01:43:42 --- 301821503
P1049 --- 26/06/2007 00:43:43 --- 26/06/2007 02:33:32 --- 1056070312
P1088 --- 26/06/2007 00:47:41 --- 26/06/2007 09:51:29 --- 312634269
R0744 --- 26/06/2007 00:47:44 --- 26/06/2007 09:46:13 --- 1068848038
P1055 --- 26/06/2007 01:03:40 --- 26/06/2007 09:54:44 --- 682893510
B0068 --- 26/06/2007 01:08:28 --- 26/06/2007 09:44:26 --- 1905880435
L0195 --- 26/06/2007 01:10:17 --- 26/06/2007 11:01:45 --- 1409172428
L0224 --- 26/06/2007 01:15:49 --- 26/06/2007 12:21:39 --- 168963861
Thanks in advance.
krvrk
6 15390
any ideas or code please!!!!!!
Motoma 3,237
Recognized Expert Specialist
Could you elaborate on what you mean by concurrent logins per day?
The total should just be: -
SELECT
-
COUNT(*)
-
FROM
-
Table
-
WHERE
-
SessionStart BETWEEN <date1> AND <date2>
-
OR
-
SessionEnd BETWEEN <date1> AND <date2>
-
Hi,
I am creating a report for which i need to query a table for total number of users and Concurrent users logged in.
The table will contain Username(nvarcar,not null),SessionStart time(datetime, not null), SessionEnd time (datetime,null), SessionID(int,not null) and ConnectGUID(uniqueidentifier, not null) etc
can any one help me in finding total and number of concurrent logins per day.
Sample Data
Username --- Starttime --- Endtime --- SessionID
FW8126 --- 26/06/2007 00:36:34 --- 26/06/2007 01:43:42 --- 301821503
P1049 --- 26/06/2007 00:43:43 --- 26/06/2007 02:33:32 --- 1056070312
P1088 --- 26/06/2007 00:47:41 --- 26/06/2007 09:51:29 --- 312634269
R0744 --- 26/06/2007 00:47:44 --- 26/06/2007 09:46:13 --- 1068848038
P1055 --- 26/06/2007 01:03:40 --- 26/06/2007 09:54:44 --- 682893510
B0068 --- 26/06/2007 01:08:28 --- 26/06/2007 09:44:26 --- 1905880435
L0195 --- 26/06/2007 01:10:17 --- 26/06/2007 11:01:45 --- 1409172428
L0224 --- 26/06/2007 01:15:49 --- 26/06/2007 12:21:39 --- 168963861
Thanks in advance.
krvrk
Thanks for your reply.
Could you elaborate on what you mean by concurrent logins per day?
Concurrent logins per day means, total no of Simultaneous sessions per day.
Thanks in advance.
krvrk
Motoma 3,237
Recognized Expert Specialist
Concurrent logins per day means, total no of Simultaneous sessions per day.
You have still been ambiguous in your explanation...
Do you mean the max number of people logged on at one time?
Or just the number of people who logged in?
Let me give you an example of why I think you need to refine your thinking of what you are looking for: -
------- Time
-
User 1 ------------------------------------------------------------
-
User 2 -------------------- ----------
-
User 3 ----------- --------------------
-
User 4 ------------------
-
In the above (poorly designed) graph, you have 4 users logging in over the course of the day. What would be the number you are looking for for "total simultaneous users"?
Hi Motoma,
Sorry for confusing you.
Actually i have been told to calculate concurrent users day.
There will be around 200 logins per day, in that i need to calculate concurrent logins per day.
I don't have any idea that which is best way to calculate concurrent logins per day (i.e claculating hourly concurrent logins per day and then averaging or calculating Max no of concurrent logins in any hour.)
So, Please suggest me best way and code. -
-------
-
---Time 8 9 10 11 12 13 14
-
User 1 ------------------------------------------------------------
-
User 2 -------------------- ------------------
-
User 3 ----------- ------------------
-
User 4 ------------------
-
User 5 ---------------------------------
-
User 6 --------
-
User 7 ------
-
User 8 ---------------------
-
User 9 ----------------------
-
User 10 --------------------------------------------
-
-
In the above example, At 8 No of concurrent users are 3, at 9 concurrent users are 5 and at 14 no of concurrent users are 6.
from this i want Average / Max concurrent(simultaneous) users loged for a single day.
I hope this (modified your example) will give clear idea.
Thanks for your replies.
krvrk
CREATE TABLE Sessions
(key_col INT NOT NULL IDENTITY PRIMARY KEY,
Hour_Min VARCHAR(10) NOT NULL,
usr VARCHAR(50) NOT NULL,
starttime DATETIME NOT NULL,
endtime DATETIME NOT NULL,
CHECK(endtime > starttime))
the Hour_Min is important, if you want max concurrent by hour then insert only the Hour part of the Session starttime in Hour_Min column. For eg, 10, 11, 12, 13, 15 (hours). You will get Max concurrent user for that hour.
if you want max concurrent by minute for eg. for 11:40 , 11:42 and so on, put the Hour:Minute part of the session starttime in Hour_Min column
SELECT Hour_Min, MAX(concurrent) AS mx
FROM (SELECT S1.Hour_Min, S1.key_col, COUNT(*) AS concurrent
FROM Sessions AS S1
JOIN Sessions AS S2
ON S1.Hour_Min = S2.Hour_Min
AND S1.starttime >= S2.starttime
AND S1.starttime < S2.endtime
GROUP BY S1.Hour_Min, S1.key_col) AS C
GROUP BY Hour_Mi
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tim Morrison |
last post by:
SQL Server 2000 - MSDE 2000
Is there a way to get the number of current users logged into a SQL 2000 Server (also MSDE)? Cant be distinct users as most users are logged into the database using the...
|
by: Wei Su |
last post by:
Hi,
I have a text file abc.txt and it looks like:
12 34 56
23 45 56
33 56 78
... .. ..
... .. ..
I want to get how many rows totally in the text file, how to do this?
Thanks.
|
by: Lenn |
last post by:
Hello,
This requirement might seem strange to someone out there, but here it's
We need to make sure only certain number of users can be logged in the site
at the same time. Is there any way to...
|
by: Augusto Ruiz García |
last post by:
Hello all,
Is there any way of finding out the number of pages a PrintDocument has
using current Printer settings? If so, how can it be done?
TIA.
|
by: gk245 |
last post by:
Trying to write a program that will figure out if a number is perfect
or not.
Here is my logic:
1) Read in the number
2) Split it up (number - 1)
3) Put all the split up numbers into an...
| |
by: jjw |
last post by:
I have a website that requires users to login. We track them by using
sessions. We record the time and date that they login, their session
id, the last page they visited, etc in a database. As...
|
by: Mike P |
last post by:
What would be the best way of counting the number of users who are
currently logged on to a website? I am making the users login against a
database of valid users. Would the best way be to add a...
|
by: babe20042004 |
last post by:
How would I go about finding every nth number in an array set? For example if i had a set containing the numbers 1-100 int each cell, how would I go about finding every 3rd number in the set.
|
by: mblank |
last post by:
Hi~,i'm trying to get a ppt's total slide number,with the office com,but i don't know which method will help,
my code can open a ppt only~
Object Nothing = Missing.Value;
...
|
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,...
|
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...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |