select 'All' as label, avg(CAST(DATEDIFF(DAY, LastAccessD...

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 'All' as label, avg(CAST(DATEDIFF(DAY, LastAccessDate, GETDATE()) as FLOAT)) as DaysSinceLastSeen
from Users
UNION
select 'Most' as label, avg(CAST(DATEDIFF(DAY, LastAccessDate, GETDATE()) as FLOAT)) as DaysSinceLastSeen
from Users
WHERE reputation > 1 and reputation < 1000
UNION
select 'Fewer' as label, avg(CAST(DATEDIFF(DAY, LastAccessDate, GETDATE()) as FLOAT)) as DaysSinceLastSeen
from Users
WHERE reputation >= 1000 and reputation < 10000

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results