| Author |
Topic |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 00:32:42
|
| The following is the login history of people who logged into the website. I would like to find the hightest number of users concurrently logged-in. 2004-03-30 13:12:55.5002004-03-30 13:12:56.1532004-03-30 13:13:04.5002004-03-30 13:13:04.7632004-03-30 13:13:22.4032004-03-30 13:13:23.1072004-03-30 13:13:23.1702004-03-30 13:13:35.0002004-03-30 13:13:35.2332004-03-30 13:14:05.5002004-03-30 13:14:06.0002004-03-30 13:14:34.2802004-03-30 13:14:34.5432004-03-30 13:14:34.5902004-03-30 13:14:40.2172004-03-30 13:14:40.2802004-03-30 13:14:53.8402004-03-30 13:14:53.8902004-03-30 13:15:08.0132004-03-30 13:15:08.0602004-03-30 13:15:36.6232004-03-30 13:15:37.2802004-03-30 13:15:37.9202004-03-30 13:15:37.9672004-03-30 13:15:46.2172004-03-30 13:15:46.2632004-03-30 13:16:06.4372004-03-30 13:16:07.0302004-03-30 13:16:07.0902004-03-30 13:16:29.6402004-03-30 13:16:29.9672004-03-30 13:16:30.0302004-03-30 13:16:38.3902004-03-30 13:16:38.6402004-03-30 13:16:38.6872004-03-30 13:16:50.5902004-03-30 13:16:50.6532004-03-30 13:17:21.8102004-03-30 13:17:21.8572004-03-30 13:17:46.5302004-03-30 13:17:46.7932004-03-30 13:17:47.3572004-03-30 13:17:47.4032004-03-30 13:18:00.8572004-03-30 13:18:00.9032004-03-30 13:18:16.4202004-03-30 13:18:17.2332004-03-30 13:18:17.2932004-03-30 13:18:51.7802004-03-30 13:18:52.0772004-03-30 13:19:00.4372004-03-30 13:19:00.7632004-03-30 13:19:21.8732004-03-30 13:19:22.4372004-03-30 13:19:22.5002004-03-30 13:19:30.4372004-03-30 13:19:31.0002004-03-30 13:19:35.0132004-03-30 13:19:35.5602004-03-30 13:19:44.1532004-03-30 13:19:44.7172004-03-30 13:19:44.7802004-03-30 13:20:38.5002004-03-30 13:20:39.0002004-03-30 13:20:44.2332004-03-30 13:20:44.9832004-03-30 13:21:03.2502004-03-30 13:21:03.5002004-03-30 13:21:03.5432004-03-30 13:21:10.3102004-03-30 13:21:10.8572004-03-30 13:21:15.2002004-03-30 13:21:15.4372004-03-30 13:21:24.6872004-03-30 13:21:24.9502004-03-30 13:21:25.0002004-03-30 13:51:34.3572004-03-30 13:51:34.7172004-03-30 13:51:39.5432004-03-30 13:51:45.7002004-03-30 13:51:46.1072004-03-30 13:51:56.4032004-03-30 13:51:56.7332004-03-30 13:51:57.0772004-03-30 13:51:57.1232004-03-30 13:52:07.6872004-03-30 13:52:07.9032004-03-30 13:52:13.5432004-03-30 13:52:21.8902004-03-30 13:52:22.1532004-03-30 13:52:47.6702004-03-30 13:52:47.9202004-03-30 13:52:47.9832004-03-30 13:52:50.5002004-03-30 13:52:50.5602004-03-30 13:59:46.6872004-03-30 13:59:53.1072004-03-30 14:00:02.3402004-03-30 14:00:09.7802004-03-30 14:00:10.0772004-03-30 14:00:14.3572004-03-30 14:00:14.6702004-03-30 14:00:25.3102004-03-30 14:00:25.5902004-03-30 14:00:25.6872004-03-30 14:00:33.9672004-03-30 14:00:34.2172004-03-30 14:00:45.3902004-03-30 14:00:45.7002004-03-30 14:01:16.5772004-03-30 14:01:16.8902004-03-30 14:01:16.9372004-03-30 14:02:48.4672004-03-30 14:02:48.5132004-03-30 14:02:53.9672004-03-30 14:02:54.0302004-03-30 14:04:15.3402004-03-30 14:04:15.3902004-03-30 14:04:15.4372004-03-30 14:04:18.8902004-03-30 14:04:18.9502004-03-30 14:04:37.9032004-03-30 14:04:37.9672004-03-30 14:04:38.2172004-03-30 14:04:38.2632004-03-30 14:04:38.3272004-03-30 14:04:51.5132004-03-30 14:04:51.5602004-03-30 14:04:51.6072004-03-30 14:04:56.7932004-03-30 14:04:56.8402004-03-30 14:04:56.9032004-03-30 14:05:21.3902004-03-30 14:05:21.4502004-03-30 14:05:21.5002004-03-30 14:05:34.9032004-03-30 14:05:34.9502004-03-30 14:05:35.0132004-03-30 14:05:35.2802004-03-30 14:05:35.3272004-03-30 14:05:35.3902004-03-30 14:05:37.7332004-03-30 14:05:37.7932004-03-30 14:05:41.1872004-03-30 14:05:41.2502004-03-30 14:05:44.1402004-03-30 14:05:44.1872004-03-30 14:05:55.9672004-03-30 14:05:56.0302004-03-30 14:06:05.2002004-03-30 14:06:05.2632004-03-30 14:06:08.6232004-03-30 14:06:08.9202004-03-30 14:06:08.9672004-03-30 14:06:11.2632004-03-30 14:06:11.3102004-03-30 14:06:14.5302004-03-30 14:06:14.8402004-03-30 14:06:14.8902004-03-30 14:06:16.6072004-03-30 14:06:16.6532004-03-30 14:06:22.3732004-03-30 14:06:22.6402004-03-30 14:06:22.7002004-03-30 14:06:27.8572004-03-31 06:12:13.4502004-03-31 06:12:47.7332004-03-31 06:13:25.6402004-03-31 06:17:45.8572004-03-31 06:17:47.3902004-03-31 06:19:28.5902004-03-31 06:23:56.3572004-03-31 06:23:56.5602004-03-31 06:25:23.1072004-03-31 06:28:10.0302004-03-31 06:29:55.5132004-03-31 06:30:21.4502004-03-31 06:30:22.5302004-03-31 06:32:16.5002004-03-31 06:33:01.8402004-03-31 06:35:11.6532004-03-31 06:35:42.0132004-03-31 06:36:03.6532004-03-31 06:36:03.7332004-03-31 06:36:14.3102004-03-31 06:36:46.0302004-03-31 06:37:16.7932004-03-31 06:38:06.0002004-03-31 06:39:03.8402004-03-31 06:39:48.4032004-03-31 06:40:50.0302004-03-31 06:43:18.8902004-03-31 06:43:49.7332004-03-31 06:44:29.3732004-03-31 06:44:58.5902004-03-31 06:45:58.9502004-03-31 06:46:11.6702004-03-31 06:47:03.9202004-03-31 06:49:05.8732004-03-31 06:51:03.7502004-03-31 06:52:13.4372004-03-31 06:53:12.2632004-03-31 06:54:43.8732004-03-31 06:54:44.1702004-03-31 06:55:14.2502004-03-31 06:55:16.2002004-03-31 06:56:27.0432004-03-31 06:57:08.7802004-03-31 06:57:11.0002004-03-31 06:57:14.4372004-03-31 06:57:26.5772004-03-31 06:58:41.5602004-03-31 07:00:00.0302004-03-31 07:00:33.3402004-03-31 07:00:39.2332004-03-31 07:02:00.7802004-03-31 07:02:51.0902004-03-31 07:03:00.5432004-03-31 07:03:02.6232004-03-31 07:03:42.7332004-03-31 07:03:47.5302004-03-31 07:03:48.5002004-03-31 07:05:32.2932004-03-31 07:06:00.8902004-03-31 07:07:04.0302004-03-31 07:07:07.7932004-03-31 07:07:19.5432004-03-31 07:07:46.1402004-03-31 07:08:41.8402004-03-31 07:10:12.1702004-03-31 07:10:51.5902004-03-31 07:11:03.3732004-03-31 07:11:25.3102004-03-31 07:11:33.5432004-03-31 07:11:45.0772004-03-31 07:13:21.5602004-03-31 07:13:41.2172004-03-31 07:13:51.0432004-03-31 07:14:05.1532004-03-31 07:14:48.8272004-03-31 07:15:37.7932004-03-31 07:15:43.2932004-03-31 07:16:05.6402004-03-31 07:17:01.5002004-03-31 07:17:16.6702004-03-31 07:17:47.2332004-03-31 07:17:50.0772004-03-31 07:18:56.3402004-03-31 07:18:57.3402004-03-31 07:19:00.2932004-03-31 07:19:27.3102004-03-31 07:19:37.6072004-03-31 07:19:59.5902004-03-31 07:20:11.2932004-03-31 07:20:16.5772004-03-31 07:20:34.3102004-03-31 07:20:54.1072004-03-31 07:21:31.3572004-03-31 07:21:45.0432004-03-31 07:22:06.2802004-03-31 07:22:52.9372004-03-31 07:23:30.2632004-03-31 07:23:32.2332004-03-31 07:24:25.7502004-03-31 07:25:04.3732004-03-31 07:27:10.4672004-03-31 07:27:41.6532004-03-31 07:28:04.5772004-03-31 07:29:25.6872004-03-31 07:29:31.5132004-03-31 07:29:37.0132004-03-31 07:31:59.0432004-03-31 07:32:14.2172004-03-31 07:33:11.5602004-03-31 07:33:23.7932004-03-31 07:33:42.8572004-03-31 07:33:59.1532004-03-31 07:34:02.0002004-03-31 07:34:05.7332004-03-31 07:34:08.0302004-03-31 07:34:08.5132004-03-31 07:35:15.4672004-03-31 07:35:25.4672004-03-31 07:35:41.6402004-03-31 07:36:01.2802004-03-31 07:36:26.1402004-03-31 07:36:47.4832004-03-31 07:37:31.8732004-03-31 07:37:44.9672004-03-31 07:37:47.7932004-03-31 07:38:07.3732004-03-31 07:38:12.7502004-03-31 07:38:15.6232004-03-31 07:38:18.3402004-03-31 07:38:28.5132004-03-31 07:38:45.7632004-03-31 07:39:35.8572004-03-31 07:40:07.8902004-03-31 07:40:18.7932004-03-31 07:40:19.1702004-03-31 07:40:22.2332004-03-31 07:40:34.2632004-03-31 07:40:38.5602004-03-31 07:41:27.8902004-03-31 07:41:50.1402004-03-31 07:41:57.4672004-03-31 07:42:19.2502004-03-31 07:42:23.7002004-03-31 07:42:27.2802004-03-31 07:42:51.8272004-03-31 07:43:25.5902004-03-31 07:43:34.7632004-03-31 07:44:09.5132004-03-31 07:44:36.7632004-03-31 07:45:31.8272004-03-31 07:45:44.0772004-03-31 07:46:41.5432004-03-31 07:46:59.0002004-03-31 07:47:17.6232004-03-31 07:47:50.5602004-03-31 07:48:01.1402004-03-31 07:48:22.6702004-03-31 07:49:03.7172004-03-31 07:49:08.6872004-03-31 07:50:04.5602004-03-31 07:50:14.1402004-03-31 07:51:00.1232004-03-31 07:51:59.0002004-03-31 07:52:06.0902004-03-31 07:53:21.0602004-03-31 07:53:25.1532004-03-31 07:53:39.5302004-03-31 07:54:06.3732004-03-31 07:54:14.5302004-03-31 07:54:33.3572004-03-31 07:54:33.5132004-03-31 07:54:42.4672004-03-31 07:54:46.0302004-03-31 07:55:06.9672004-03-31 07:55:18.5602004-03-31 07:55:18.7932004-03-31 07:55:25.0602004-03-31 07:56:14.7502004-03-31 07:56:23.4372004-03-31 07:56:28.3732004-03-31 07:56:35.5302004-03-31 07:56:45.3572004-03-31 07:56:45.5132004-03-31 07:57:23.0902004-03-31 07:57:25.7172004-03-31 07:57:30.1872004-03-31 07:57:34.0132004-03-31 07:57:37.7002004-03-31 07:57:59.4502004-03-31 07:58:09.4832004-03-31 07:58:18.7002004-03-31 07:58:20.6232004-03-31 07:58:52.0902004-03-31 07:58:55.9372004-03-31 07:59:02.4832004-03-31 07:59:10.2932004-03-31 07:59:34.0132004-03-31 07:59:39.4372004-03-31 07:59:39.7002004-03-31 07:59:41.4372004-03-31 07:59:51.1072004-03-31 08:00:09.2002004-03-31 08:00:09.7502004-03-31 08:00:24.0902004-03-31 08:01:43.8402004-03-31 08:02:02.5432004-03-31 08:02:11.2332004-03-31 08:02:25.3102004-03-31 08:02:38.1702004-03-31 08:03:07.8902004-03-31 08:03:37.8402004-03-31 08:03:44.1872004-03-31 08:04:22.6532004-03-31 08:04:24.2172004-03-31 08:04:33.7002004-03-31 08:04:51.7172004-03-31 08:04:59.2332004-03-31 08:05:00.7932004-03-31 08:05:02.6872004-03-31 08:05:17.9202004-03-31 08:05:40.8732004-03-31 08:06:09.2932004-03-31 08:06:12.5602004-03-31 08:06:12.5772004-03-31 08:06:16.0302004-03-31 08:06:23.1402004-03-31 08:06:28.0772004-03-31 08:06:28.5302004-03-31 08:06:35.5602004-03-31 08:06:47.6532004-03-31 08:07:47.3902004-03-31 08:07:47.7932004-03-31 08:07:57.4672004-03-31 08:07:57.5132004-03-31 08:07:59.6232004-03-31 08:08:02.6402004-03-31 08:08:08.2002004-03-31 08:08:31.3902004-03-31 08:08:43.2002004-03-31 08:09:40.5772004-03-31 08:09:48.1232004-03-31 08:09:50.3102004-03-31 08:09:53.2932004-03-31 08:10:03.6232004-03-31 08:10:10.0902004-03-31 08:10:26.5772004-03-31 08:10:42.4202004-03-31 08:10:47.4502004-03-31 08:10:48.9832004-03-31 08:11:03.1232004-03-31 08:11:04.5772004-03-31 08:11:34.4032004-03-31 08:12:05.7002004-03-31 08:12:28.8272004-03-31 08:12:32.2502004-03-31 08:12:45.4372004-03-31 08:13:04.5432004-03-31 08:13:05.1072004-03-31 08:13:11.9032004-03-31 08:13:31.0772004-03-31 08:13:48.4032004-03-31 08:13:51.5432004-03-31 08:13:56.0902004-03-31 08:14:17.5302004-03-31 08:14:44.8572004-03-31 08:15:02.7802004-03-31 08:15:03.0772004-03-31 08:15:17.1232004-03-31 08:15:23.2002004-03-31 08:16:13.4372004-03-31 08:16:33.2802004-03-31 08:16:36.8902004-03-31 08:17:03.2002004-03-31 08:17:13.3402004-03-31 08:17:15.8732004-03-31 08:17:31.7002004-03-31 08:17:34.2632004-03-31 08:18:08.7632004-03-31 08:18:26.8272004-03-31 08:18:32.9372004-03-31 08:18:40.8732004-03-31 08:18:42.5132004-03-31 08:18:53.5772004-03-31 08:19:02.8402004-03-31 08:19:13.0132004-03-31 08:19:52.5772004-03-31 08:19:55.5302004-03-31 08:20:53.7502004-03-31 08:21:09.3102004-03-31 08:21:15.4372004-03-31 08:21:23.2502004-03-31 08:22:12.3402004-03-31 08:22:13.0132004-03-31 08:22:25.9502004-03-31 08:22:33.3572004-03-31 08:23:04.4032004-03-31 08:23:11.7932004-03-31 08:23:12.0302004-03-31 08:23:15.3272004-03-31 08:23:17.5902004-03-31 08:23:32.8402004-03-31 08:23:55.687 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-06 : 00:44:39
|
| Are you serious?????? Is this the starttime, endtime??? Do you have those as seperate columns? Do you have what users these were? This information is worthless if you don't at least have another column with the endtime, or two more columns to show user and starttime or endtime status.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-06 : 00:54:47
|
quote: Originally posted by derrickleggett Are you serious?????? Is this the starttime, endtime??? Do you have those as seperate columns? Do you have what users these were? This information is worthless if you don't at least have another column with the endtime, or two more columns to show user and starttime or endtime status.
That's why he is called the Mean Old DBA Duane. |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 00:56:12
|
| well, this is a login history date column for each person. There are no login start time and end time.I am trying to see how many people were logged in at the same time and what was the maximum number of concurrent users |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 01:02:25
|
--better exampleLogin_id Login_date1 2004-03-31 08:18:53.5772 2004-03-31 08:19:02.8403 2004-03-31 08:19:13.0134 2004-03-31 08:19:52.5775 2004-03-31 08:19:55.5306 2004-03-31 08:20:53.7507 2004-03-31 08:21:09.3108 2004-03-31 08:21:15.4379 2004-03-31 08:21:23.25010 2004-03-31 08:22:12.34011 2004-03-31 08:22:13.01312 2004-03-31 08:22:25.95013 2004-03-31 08:22:33.35714 2004-03-31 08:23:04.40315 2004-03-31 08:23:11.79316 2004-03-31 08:23:12.03017 2004-03-31 08:23:15.32718 2004-03-31 08:23:17.59019 2004-03-31 08:23:32.840 |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-06 : 01:06:01
|
| I still don't understand.How do you know when the person who logged in at say 2004-03-31 08:21:23.250 Logged off the system?Without knowing that it is impossible to determine concurrent logins.Duane. |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 01:23:19
|
| I should have said thati need to know how many people were logged in at the same time.for example3 people logged in 2004-03-30 13:13:04.76310 people logged in 2004-03-30 13:13:04.500 |
 |
|
|
scullee
Posting Yak Master
103 Posts |
Posted - 2004-07-06 : 01:29:34
|
| select count(end_time) as Logged_in, end_timefrom <table_name>group by end_timeThe group by will only work if the times are exact, if you are looking at times for specific minutes or something you will have to reformat the dates. |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 01:30:30
|
| Do i need to know the log off time to be able to get this result? I still don't get it why i need a log off time. |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2004-07-06 : 01:59:33
|
| How do i reformat the datetime if i want to compare for specific minutes ? |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-06 : 07:56:16
|
| SELECTCOUNT(CONVERT(VARCHAR,end_time,120)) as Logged_in, CONVERT(VARCHAR,end_time,120) AS end_timefrom <table_name>group by CONVERT(VARCHAR,end_time,120)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Pat Phelan
Posting Yak Master
187 Posts |
Posted - 2004-07-06 : 14:10:36
|
| I think that we're missing a fundamental point here. If the list is login times, and only login times, you can make one of three assumptions. You can assume that the person logged off immediately, in which case there was only 1 simultanteous login because they logged off before anyone else could log on. You can assume that the person never logged off, in which case there were as many simultaneous logins as there were logins (since they would all be simultaneous). You can assume that logins took some finite amount of time, which makes the number of simultaneous logins fall somewhere between zero and the total number of logins.Without some way to find the duration of each login, we don't have any way to compute the number of simultaneous logins.-PatP |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-06 : 21:05:15
|
| > How do i reformat the datetime if i want to compare for specific minutes ?SELECT DATEADD(Minute, DATEDIFF(Minute, 0, Login_date), 0) |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-06 : 23:27:26
|
| I think I tried to explain that pretty hard Pat and gave up.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-07-07 : 00:06:25
|
| Yeah - I divorsed myself from this thread for the same reason.Duane. |
 |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-07-07 : 01:52:59
|
This should give you something useful, although as everyone mentioned, you did not exactly say what you wanted.--Create a table of numbers to use to calculate intervals. Only run this once. A Numbers table comes in handy--for verious things anyway.Create view ZeroToTen AS select 0 ID union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9SELECT ID = IDENTITY(int, 1, 1)INTO NumbersFROM ZeroToTen T1, ZeroToTen T2, ZeroToTen T3, ZeroToTen T4--Loaded your sample dataCREATE TABLE loginlog (logintime datetime)BULK INSERT loginlog FROM 'c:\temp\ltimes.txt'--- This is the script to summarize logins based on time period (seconds) intervalsdeclare @seconds_interval intselect @seconds_interval = 600 --10 minutes--select @seconds_interval = 3600 --1 hourselect count(1) LoginCount, ranges.start_interval period from loginlog ,(select dateadd(s, ID * @seconds_interval,(select min(logintime) from loginlog)) start_interval , dateadd(ss,@seconds_interval - 1, dateadd(s, ID * @seconds_interval,(select min(logintime) from loginlog))) end_intervalfrom Numberswhere ID < (SELECT datediff(s, min(logintime), max(logintime)) from loginlog)) rangeswhere logintime between ranges.start_interval and ranges.end_intervalgroup by ranges.start_interval--order by count(1)order by ranges.start_interval --Seconds Interval = 600, order by loginsLoginCount period ----------- ------------------------------------------------------ 2 2004-03-31 06:02:55.5004 2004-03-31 06:12:55.5007 2004-03-31 08:22:55.5008 2004-03-31 06:22:55.50010 2004-03-31 06:42:55.50012 2004-03-31 06:32:55.50012 2004-03-31 07:22:55.50016 2004-03-31 06:52:55.50018 2004-03-31 07:02:55.50019 2004-03-30 13:42:55.50019 2004-03-31 07:42:55.50021 2004-03-30 13:52:55.50026 2004-03-31 07:12:55.50037 2004-03-31 07:32:55.50039 2004-03-31 08:12:55.50045 2004-03-31 07:52:55.50047 2004-03-31 08:02:55.50049 2004-03-30 14:02:55.500Change order by or interval to get different results--Seconds Interval = 3600, order by interval dateLoginCount period ----------- ------------------------------------------------------ 2 2004-03-31 05:12:55.50068 2004-03-31 06:12:55.500186 2004-03-31 07:12:55.50046 2004-03-31 08:12:55.500This may be slow if you have a lot of data and/or poor indexes on your table. |
 |
|
|
|