select DATEADD(wk, DATEDIFF(wk,0,LastAccessDate), 0) [Las...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select DATEADD(wk, DATEDIFF(wk,0,LastAccessDate), 0) [Last access]
     , count(*) 
from users
where lastaccessdate < DATEADD(wk, DATEDIFF(wk,0, (select create_date from sys.tables where object_id =object_id('Users'))),-1)
group by DATEADD(wk, DATEDIFF(wk,0,LastAccessDate), 0) 
order by DATEADD(wk, DATEDIFF(wk,0,LastAccessDate), 0)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results