Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have a database which contains user_id that has logintime (which gives logintime everytime a user logs into application)I am trying to get total number of users that logged in once a week, twice a week, once a day, twice a day.Can you please help me out in this.Thanks.Reddy.
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-06-05 : 19:33:43
once / twice a day
select dateadd(day, datediff(day, 0, logintime), 0), count(*)from yourtablegroup by dateadd(day, datediff(day, 0, logintime), 0)having count(*) = 1 -- 2 : twice a day