select '1. Active Users' category , count(*) [cnt] from u...

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 '1. Active Users' category
     , count(*) [cnt]
from users 
where lastaccessdate between '2018-01-01' and '2018-12-31'
union
select '2. Total Users' category
     , count(*) [cnt]
from users 

union
select case posttypeid  
       when 1 then '3. New Questions' 
       when 2 then '4. New Answers' 
       end 
     , count(*)
from postswithdeleted
where creationdate between '2018-01-01' and '2018-12-31'
and posttypeid in (1,2)
group by posttypeid
union

select '5. New Comments'
     , count(*) [cnt]
from comments
where creationdate between '2018-01-01' and '2018-12-31'

order by 1

Enter Parameters

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