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 |
|
anandmuthiah
Starting Member
2 Posts |
Posted - 2011-02-16 : 18:41:48
|
| Hi,I have a table called UserLogin having Date, time and loginName in SQL server. I need to get the no of logins for every 10 min. Say for example time 0:00 - 15,0:10- 5, 0:20-32 like that.How can I achive this.Thanks,AnandAnand |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
anandmuthiah
Starting Member
2 Posts |
Posted - 2011-02-16 : 20:28:02
|
| The data stored in the Table is not current data. It is up to previous day data. Like that I have data for a month. I need the no of Login's for every 10 minutes for the hole month day by day. Say for every day I must have 144 entries(6 entries per hour * 24).ThanksAnand |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2011-02-17 : 08:58:05
|
| Try following the "How to ask" link in my signature, and provide the information it requests. Then we can come up with a much better answer for you.OR Peter will see this, read your mind, and give you the correct answer.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-02-17 : 09:52:05
|
UserLogin having Date, time and loginName in SQL serverSELECT DATEADD(MINUTE, DATEDIFF(MINUTE, 0, [Time]), 0), COUNT(*)FROM dbo.UserLoginWHERE [Date] = '20110217'GROUP BY DATEADD(MINUTE, DATEDIFF(MINUTE, 0, [Time]), 0)ORDER BY DATEADD(MINUTE, DATEDIFF(MINUTE, 0, [Time]), 0) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|
|
|