Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
da42
Starting Member
3 Posts |
Posted - 2010-09-24 : 15:57:15
|
| Please, here's a scenario that I've been approaching with brute force but I need a more elegant solution.Given:Table 'Activity' has 4 fields: .TransID (integer identity), .UserID (integer), .FromDateTime & .ToDateTime... It is a log of when each user was logged into a software environment. VERY high volume table.Question:What query would show me the highest volume of users logged into that environment at the same time? Or to be more complicated, at the same time, but within a timeframe between two variables, @dFromDateTime and @dToDateTime?My brute force approach is to declare a varb table, insert in 'moments' by looping through 15 second intervals between @dFromDateTime and @dToDateTime, and then a join with the Activity table. But those moments are not really encompassing all spans of time, theoretically. Any thoughts? Thanks in advance. |
|
|
|
|
|