select 'Registered between 9/2011 - 6/2012' user_category...

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 'Registered between 9/2011 - 6/2012' user_category,
count(*) number_of_users from users u
where CreationDate > '2011-09-23'
and CreationDate < '2012-06-01'

union
select 'No Logins',
count(*) from users u
where CreationDate > '2011-09-23'
and CreationDate < '2012-06-01'
and LastAccessDate - CreationDate < DAY(1)
and reputation < 10

union
select 'No Logins, No Votes',
count(*) from users u
where CreationDate > '2011-09-23'
and CreationDate < '2012-06-01'
and LastAccessDate - CreationDate < DAY(1)
and UpVotes = 0
and DownVotes = 0
and reputation < 10

union
select 'No Logins, No Votes, No Posts',
count(*) from users u
left outer join posts p on u.id = p.OwnerUserId
where u.CreationDate > '2011-09-23'
and u.CreationDate < '2012-06-01'
and u.LastAccessDate - u.CreationDate < DAY(1)
and u.UpVotes = 0
and u.DownVotes = 0
and reputation < 10
and p.id is null

Enter Parameters

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